polytexnic 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/polytexnic +29 -10
- data/lib/polytexnic/preprocessors/html.rb +1 -1
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/core_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1f2eb8f0ea1afe5f4f09645beb2d38100c9bdafc097fcd5943ac222d41fc592
|
4
|
+
data.tar.gz: c0ea88d4a8fbdb470be081cd446b5f3d007d37e5a1df7eec8a3197a07ecc146a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bb4ddcd578b51b1683f00fcfd78325964ccc0461a46c4ac98826fc73b22912448d9ec9fc12bda4877869b755a77dcf5cc0faf828f6ebd94ea5c15e1aa04389
|
7
|
+
data.tar.gz: e37c38285cab036bbabe23a8444587547ea63084f0f73171887d0ad8b512983be1704d2d4efe709796b37464c9155abf1167996913c6d97d0e24bbd624c2273e
|
data/Gemfile.lock
CHANGED
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 = %(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
polytexnic
|
16
|
-
polytexnic
|
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
|
data/lib/polytexnic/version.rb
CHANGED
data/spec/to_html/core_spec.rb
CHANGED
@@ -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.
|
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:
|
12
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|