polytexnic 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 941f1eb78908726af53bd97f91cbcbfb528805328149e6d1b38e1b5cea42e0d1
4
- data.tar.gz: bfdb4f07708016f5edf71bb4fce5438a513dfbf57a1d3de96a2aac91f445d1e0
3
+ metadata.gz: d1f2eb8f0ea1afe5f4f09645beb2d38100c9bdafc097fcd5943ac222d41fc592
4
+ data.tar.gz: c0ea88d4a8fbdb470be081cd446b5f3d007d37e5a1df7eec8a3197a07ecc146a
5
5
  SHA512:
6
- metadata.gz: d8eec9d8e3922e7950210938453e7f2a945c7afd225c20f83280003f62ffba4d1fcaa4a126e729135454d81dce11b1300e00e75b1a5039c5e4dc8b0e8947164a
7
- data.tar.gz: a3e720691cdd208445f1e78e3050ca36030ec0421929f42d9cffd718752f237ae4f8ffae80ec3899c43f40eea29e6ced41bb5f2cc905a847124a0a63ed9fa42b
6
+ metadata.gz: f6bb4ddcd578b51b1683f00fcfd78325964ccc0461a46c4ac98826fc73b22912448d9ec9fc12bda4877869b755a77dcf5cc0faf828f6ebd94ea5c15e1aa04389
7
+ data.tar.gz: e37c38285cab036bbabe23a8444587547ea63084f0f73171887d0ad8b512983be1704d2d4efe709796b37464c9155abf1167996913c6d97d0e24bbd624c2273e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.6.0)
4
+ polytexnic (1.6.1)
5
5
  json (~> 2.3.0)
6
6
  kramdown (>= 1.17, < 3.0)
7
7
  msgpack (~> 1.2.0)
data/bin/polytexnic CHANGED
@@ -4,26 +4,31 @@ require 'optparse'
4
4
  require 'fileutils'
5
5
 
6
6
  # polytexnic command-line script
7
- # The polytexnic script converts Markdown to LaTeX
7
+ # The polytexnic script converts Markdown to HTML or LaTeX
8
8
  # using the PolyTeXnic HTML pipeline.
9
9
 
10
- examples = %(Examples:
11
- polytexnic example.md example.tex
12
- polytexnic example.md > example.tex
13
- polytexnic < example.md > example.tex
14
- cat example.md | polytexnic > example.tex
15
- polytexnic -f example.md > example.tex
16
- polytexnic -f example.md -o example.tex)
10
+ examples = %(
11
+ The polytexnic script converts Markdown to HTML or LaTeX
12
+ using the PolyTeXnic HTML pipeline.
13
+
14
+ Examples:
15
+ polytexnic example.md example.html
16
+ polytexnic example.md > example.html
17
+ polytexnic < example.md > example.html
18
+ cat example.md | polytexnic > example.html
19
+ polytexnic -i example.md > example.html
20
+ polytexnic -i example.md -o example.tex
21
+ polytexnic -f tex example.md)
17
22
 
18
23
  options = {}
19
24
  OptionParser.new do |opts|
20
25
  opts.banner = "Usage: polytexnic [options]\n#{examples}\n\n"
21
26
 
22
- opts.on("-i", "--input", "Use file input") do |infile|
27
+ opts.on("-i", "--input=INPUT", "Use file input") do |infile|
23
28
  options[:infile] = infile
24
29
  end
25
30
 
26
- opts.on("-o", "--output", "Use file output") do |outfile|
31
+ opts.on("-o", "--output=OUTPUT", "Use file output") do |outfile|
27
32
  options[:outfile] = outfile
28
33
  end
29
34
 
@@ -35,17 +40,31 @@ end.parse!
35
40
  # Returns the file format based on extension.
36
41
  # Should be 'html' or 'tex'.
37
42
  def format(filename)
43
+ puts '***********'
44
+ puts '***********'
45
+ puts '***********'
46
+ puts '***********'
47
+ puts '***********'
48
+ p filename.split('.')
38
49
  filename.split('.').last
39
50
  rescue
40
51
  nil
41
52
  end
42
53
 
54
+ puts '$$$$$$$$$$$'
55
+ puts '$$$$$$$$$$$'
56
+ puts '$$$$$$$$$$$'
57
+ puts '$$$$$$$$$$$'
58
+ puts '$$$$$$$$$$$'
59
+ p options
43
60
  if (infile = options[:infile] || ARGV.shift)
61
+ puts infile
44
62
  input = File.read(infile)
45
63
  else
46
64
  input = STDIN.read
47
65
  end
48
66
  outfile = options[:outfile] || ARGV.shift
67
+ puts outfile
49
68
  pipeline = Polytexnic::Pipeline.new(input, article: true)
50
69
  format = options[:format] || format(outfile) || "html"
51
70
  if format == "html"
@@ -140,7 +140,7 @@ module Polytexnic
140
140
  # Removes commented-out lines.
141
141
  # Contents of the special sequence `%=` are converted to literal HTML.
142
142
  def remove_comments(output)
143
- output.gsub!(/[^\\]%[^=].*$/, '')
143
+ output.gsub!(/([^\\])(%[^=].*$)/, '\1')
144
144
  output.gsub!(/[^\\]%=(.*)$/) do
145
145
  key = digest($1)
146
146
  literal_html_cache[key] = $1
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
@@ -9,6 +9,15 @@ describe 'Polytexnic::Pipeline#to_html' do
9
9
  let(:polytex) { "% A LaTeX comment" }
10
10
  it { should eq '' }
11
11
 
12
+ context "occurring a the end of a line" do
13
+ let(:polytex) do <<-'EOS'
14
+ lorem ipsum
15
+ dolor sit amet.%this is a comment
16
+ EOS
17
+ end
18
+ it { should include("amet.") }
19
+ end
20
+
12
21
  context "with a section and label" do
13
22
  let(:polytex) do <<-'EOS'
14
23
  % \section{Foo}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polytexnic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-01 00:00:00.000000000 Z
12
+ date: 2021-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri