polytexnic 1.5.16 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +14 -12
- data/bin/polytexnic +55 -12
- data/lib/polytexnic/postprocessors/html.rb +1 -1
- data/lib/polytexnic/version.rb +1 -1
- data/polytexnic.gemspec +1 -1
- data/spec/to_html/text_formatting_spec.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 941f1eb78908726af53bd97f91cbcbfb528805328149e6d1b38e1b5cea42e0d1
|
4
|
+
data.tar.gz: bfdb4f07708016f5edf71bb4fce5438a513dfbf57a1d3de96a2aac91f445d1e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8eec9d8e3922e7950210938453e7f2a945c7afd225c20f83280003f62ffba4d1fcaa4a126e729135454d81dce11b1300e00e75b1a5039c5e4dc8b0e8947164a
|
7
|
+
data.tar.gz: a3e720691cdd208445f1e78e3050ca36030ec0421929f42d9cffd718752f237ae4f8ffae80ec3899c43f40eea29e6ced41bb5f2cc905a847124a0a63ed9fa42b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.
|
4
|
+
polytexnic (1.6.0)
|
5
5
|
json (~> 2.3.0)
|
6
|
-
kramdown (
|
6
|
+
kramdown (>= 1.17, < 3.0)
|
7
7
|
msgpack (~> 1.2.0)
|
8
8
|
nokogiri (~> 1.10.8)
|
9
9
|
pygments.rb (~> 1.2.1)
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
coderay (1.1.
|
14
|
+
coderay (1.1.3)
|
15
15
|
columnize (0.9.0)
|
16
16
|
coveralls (0.7.2)
|
17
17
|
multi_json (~> 1.3)
|
@@ -23,9 +23,9 @@ GEM
|
|
23
23
|
debugger2 (1.0.0.beta2)
|
24
24
|
columnize (>= 0.3.1)
|
25
25
|
debugger-linecache (~> 1.2.0)
|
26
|
-
diff-lcs (1.
|
26
|
+
diff-lcs (1.4.4)
|
27
27
|
docile (1.1.5)
|
28
|
-
ffi (1.
|
28
|
+
ffi (1.13.1)
|
29
29
|
formatador (0.2.5)
|
30
30
|
growl (1.0.3)
|
31
31
|
guard (2.16.2)
|
@@ -42,21 +42,22 @@ GEM
|
|
42
42
|
guard (~> 2.1)
|
43
43
|
guard-compat (~> 1.1)
|
44
44
|
rspec (>= 2.99.0, < 4.0)
|
45
|
-
json (2.3.
|
46
|
-
kramdown (
|
45
|
+
json (2.3.1)
|
46
|
+
kramdown (2.3.0)
|
47
|
+
rexml
|
47
48
|
listen (3.2.1)
|
48
49
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
49
50
|
rb-inotify (~> 0.9, >= 0.9.10)
|
50
|
-
lumberjack (1.2.
|
51
|
+
lumberjack (1.2.7)
|
51
52
|
method_source (1.0.0)
|
52
53
|
mime-types (3.3.1)
|
53
54
|
mime-types-data (~> 3.2015)
|
54
|
-
mime-types-data (3.
|
55
|
+
mime-types-data (3.2020.0512)
|
55
56
|
mini_portile2 (2.4.0)
|
56
57
|
msgpack (1.2.10)
|
57
|
-
multi_json (1.
|
58
|
+
multi_json (1.15.0)
|
58
59
|
nenv (0.3.0)
|
59
|
-
nokogiri (1.10.
|
60
|
+
nokogiri (1.10.10)
|
60
61
|
mini_portile2 (~> 2.4.0)
|
61
62
|
notiffany (0.1.3)
|
62
63
|
nenv (~> 0.1)
|
@@ -67,11 +68,12 @@ GEM
|
|
67
68
|
pygments.rb (1.2.1)
|
68
69
|
multi_json (>= 1.0.0)
|
69
70
|
rake (13.0.1)
|
70
|
-
rb-fsevent (0.10.
|
71
|
+
rb-fsevent (0.10.4)
|
71
72
|
rb-inotify (0.10.1)
|
72
73
|
ffi (~> 1.0)
|
73
74
|
rest-client (1.6.7)
|
74
75
|
mime-types (>= 1.16)
|
76
|
+
rexml (3.2.4)
|
75
77
|
rspec (2.99.0)
|
76
78
|
rspec-core (~> 2.99.0)
|
77
79
|
rspec-expectations (~> 2.99.0)
|
data/bin/polytexnic
CHANGED
@@ -1,19 +1,62 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "polytexnic"
|
3
|
+
require 'optparse'
|
4
|
+
require 'fileutils'
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
# polytexnic command-line script
|
7
|
+
# The polytexnic script converts Markdown to LaTeX
|
8
|
+
# using the PolyTeXnic HTML pipeline.
|
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)
|
17
|
+
|
18
|
+
options = {}
|
19
|
+
OptionParser.new do |opts|
|
20
|
+
opts.banner = "Usage: polytexnic [options]\n#{examples}\n\n"
|
21
|
+
|
22
|
+
opts.on("-i", "--input", "Use file input") do |infile|
|
23
|
+
options[:infile] = infile
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on("-o", "--output", "Use file output") do |outfile|
|
27
|
+
options[:outfile] = outfile
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on("-f", "--format", "Use output format [html, tex]") do |format|
|
31
|
+
options[:format] = format
|
32
|
+
end
|
33
|
+
end.parse!
|
34
|
+
|
35
|
+
# Returns the file format based on extension.
|
36
|
+
# Should be 'html' or 'tex'.
|
37
|
+
def format(filename)
|
38
|
+
filename.split('.').last
|
39
|
+
rescue
|
40
|
+
nil
|
6
41
|
end
|
7
42
|
|
8
|
-
if ARGV.
|
9
|
-
|
43
|
+
if (infile = options[:infile] || ARGV.shift)
|
44
|
+
input = File.read(infile)
|
10
45
|
else
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
46
|
+
input = STDIN.read
|
47
|
+
end
|
48
|
+
outfile = options[:outfile] || ARGV.shift
|
49
|
+
pipeline = Polytexnic::Pipeline.new(input, article: true)
|
50
|
+
format = options[:format] || format(outfile) || "html"
|
51
|
+
if format == "html"
|
52
|
+
output = pipeline.to_html
|
53
|
+
elsif format == "tex"
|
54
|
+
output = pipeline.to_polytex
|
55
|
+
else
|
56
|
+
raise ArgumentError, "Invalid format: #{format}"
|
57
|
+
end
|
58
|
+
if outfile
|
59
|
+
File.write(outfile, output)
|
60
|
+
else
|
61
|
+
puts output.strip
|
19
62
|
end
|
data/lib/polytexnic/version.rb
CHANGED
data/polytexnic.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency 'nokogiri', '~> 1.10.8'
|
22
22
|
gem.add_dependency 'pygments.rb', '~> 1.2.1'
|
23
23
|
gem.add_dependency 'msgpack', '~> 1.2.0'
|
24
|
-
gem.add_dependency 'kramdown', '
|
24
|
+
gem.add_dependency 'kramdown', '>= 1.17', '< 3.0'
|
25
25
|
gem.add_dependency 'json', '~> 2.3.0'
|
26
26
|
|
27
27
|
gem.add_development_dependency 'rspec', '~> 2.14'
|
@@ -29,7 +29,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
29
29
|
|
30
30
|
describe "small caps" do
|
31
31
|
let(:polytex) { '\textsc{small caps}' }
|
32
|
-
it { should resemble '<span class="
|
32
|
+
it { should resemble '<span class="smallcaps">small caps</span>' }
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "small text" do
|
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.
|
4
|
+
version: 1.6.0
|
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-
|
12
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -57,16 +57,22 @@ dependencies:
|
|
57
57
|
name: kramdown
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.17'
|
63
|
+
- - "<"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.0'
|
63
66
|
type: :runtime
|
64
67
|
prerelease: false
|
65
68
|
version_requirements: !ruby/object:Gem::Requirement
|
66
69
|
requirements:
|
67
|
-
- - "
|
70
|
+
- - ">="
|
68
71
|
- !ruby/object:Gem::Version
|
69
72
|
version: '1.17'
|
73
|
+
- - "<"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
70
76
|
- !ruby/object:Gem::Dependency
|
71
77
|
name: json
|
72
78
|
requirement: !ruby/object:Gem::Requirement
|