polytexnic 1.5.13 → 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/.gitignore +1 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +110 -0
- data/bin/polytexnic +74 -12
- data/lib/polytexnic/postprocessors/html.rb +25 -19
- data/lib/polytexnic/preprocessors/html.rb +1 -1
- data/lib/polytexnic/version.rb +1 -1
- data/polytexnic.gemspec +4 -4
- data/spec/to_html/asides_spec.rb +2 -2
- data/spec/to_html/chapters_and_sections_spec.rb +8 -8
- data/spec/to_html/codelistings_spec.rb +2 -2
- data/spec/to_html/core_spec.rb +28 -0
- data/spec/to_html/footnote_spec.rb +6 -6
- data/spec/to_html/graphics_and_figures_spec.rb +3 -3
- data/spec/to_html/text_formatting_spec.rb +1 -1
- metadata +17 -11
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/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
polytexnic (1.6.1)
|
5
|
+
json (~> 2.3.0)
|
6
|
+
kramdown (>= 1.17, < 3.0)
|
7
|
+
msgpack (~> 1.2.0)
|
8
|
+
nokogiri (~> 1.10.8)
|
9
|
+
pygments.rb (~> 1.2.1)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
coderay (1.1.3)
|
15
|
+
columnize (0.9.0)
|
16
|
+
coveralls (0.7.2)
|
17
|
+
multi_json (~> 1.3)
|
18
|
+
rest-client (= 1.6.7)
|
19
|
+
simplecov (>= 0.7)
|
20
|
+
term-ansicolor (= 1.2.2)
|
21
|
+
thor (= 0.18.1)
|
22
|
+
debugger-linecache (1.2.0)
|
23
|
+
debugger2 (1.0.0.beta2)
|
24
|
+
columnize (>= 0.3.1)
|
25
|
+
debugger-linecache (~> 1.2.0)
|
26
|
+
diff-lcs (1.4.4)
|
27
|
+
docile (1.1.5)
|
28
|
+
ffi (1.13.1)
|
29
|
+
formatador (0.2.5)
|
30
|
+
growl (1.0.3)
|
31
|
+
guard (2.16.2)
|
32
|
+
formatador (>= 0.2.4)
|
33
|
+
listen (>= 2.7, < 4.0)
|
34
|
+
lumberjack (>= 1.0.12, < 2.0)
|
35
|
+
nenv (~> 0.1)
|
36
|
+
notiffany (~> 0.0)
|
37
|
+
pry (>= 0.9.12)
|
38
|
+
shellany (~> 0.0)
|
39
|
+
thor (>= 0.18.1)
|
40
|
+
guard-compat (1.2.1)
|
41
|
+
guard-rspec (4.7.3)
|
42
|
+
guard (~> 2.1)
|
43
|
+
guard-compat (~> 1.1)
|
44
|
+
rspec (>= 2.99.0, < 4.0)
|
45
|
+
json (2.3.1)
|
46
|
+
kramdown (2.3.0)
|
47
|
+
rexml
|
48
|
+
listen (3.2.1)
|
49
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
50
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
51
|
+
lumberjack (1.2.7)
|
52
|
+
method_source (1.0.0)
|
53
|
+
mime-types (3.3.1)
|
54
|
+
mime-types-data (~> 3.2015)
|
55
|
+
mime-types-data (3.2020.0512)
|
56
|
+
mini_portile2 (2.4.0)
|
57
|
+
msgpack (1.2.10)
|
58
|
+
multi_json (1.15.0)
|
59
|
+
nenv (0.3.0)
|
60
|
+
nokogiri (1.10.10)
|
61
|
+
mini_portile2 (~> 2.4.0)
|
62
|
+
notiffany (0.1.3)
|
63
|
+
nenv (~> 0.1)
|
64
|
+
shellany (~> 0.0)
|
65
|
+
pry (0.13.1)
|
66
|
+
coderay (~> 1.1)
|
67
|
+
method_source (~> 1.0)
|
68
|
+
pygments.rb (1.2.1)
|
69
|
+
multi_json (>= 1.0.0)
|
70
|
+
rake (13.0.1)
|
71
|
+
rb-fsevent (0.10.4)
|
72
|
+
rb-inotify (0.10.1)
|
73
|
+
ffi (~> 1.0)
|
74
|
+
rest-client (1.6.7)
|
75
|
+
mime-types (>= 1.16)
|
76
|
+
rexml (3.2.4)
|
77
|
+
rspec (2.99.0)
|
78
|
+
rspec-core (~> 2.99.0)
|
79
|
+
rspec-expectations (~> 2.99.0)
|
80
|
+
rspec-mocks (~> 2.99.0)
|
81
|
+
rspec-core (2.99.2)
|
82
|
+
rspec-expectations (2.99.2)
|
83
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
84
|
+
rspec-mocks (2.99.4)
|
85
|
+
shellany (0.0.1)
|
86
|
+
simplecov (0.15.1)
|
87
|
+
docile (~> 1.1.0)
|
88
|
+
json (>= 1.8, < 3)
|
89
|
+
simplecov-html (~> 0.10.0)
|
90
|
+
simplecov-html (0.10.2)
|
91
|
+
term-ansicolor (1.2.2)
|
92
|
+
tins (~> 0.8)
|
93
|
+
thor (0.18.1)
|
94
|
+
tins (0.13.2)
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
ruby
|
98
|
+
|
99
|
+
DEPENDENCIES
|
100
|
+
coveralls
|
101
|
+
debugger2
|
102
|
+
growl
|
103
|
+
guard-rspec
|
104
|
+
polytexnic!
|
105
|
+
rake
|
106
|
+
rspec (~> 2.14)
|
107
|
+
simplecov (~> 0.15.1)
|
108
|
+
|
109
|
+
BUNDLED WITH
|
110
|
+
2.1.4
|
data/bin/polytexnic
CHANGED
@@ -1,19 +1,81 @@
|
|
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 HTML or LaTeX
|
8
|
+
# using the PolyTeXnic HTML pipeline.
|
9
|
+
|
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)
|
22
|
+
|
23
|
+
options = {}
|
24
|
+
OptionParser.new do |opts|
|
25
|
+
opts.banner = "Usage: polytexnic [options]\n#{examples}\n\n"
|
26
|
+
|
27
|
+
opts.on("-i", "--input=INPUT", "Use file input") do |infile|
|
28
|
+
options[:infile] = infile
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-o", "--output=OUTPUT", "Use file output") do |outfile|
|
32
|
+
options[:outfile] = outfile
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("-f", "--format", "Use output format [html, tex]") do |format|
|
36
|
+
options[:format] = format
|
37
|
+
end
|
38
|
+
end.parse!
|
39
|
+
|
40
|
+
# Returns the file format based on extension.
|
41
|
+
# Should be 'html' or 'tex'.
|
42
|
+
def format(filename)
|
43
|
+
puts '***********'
|
44
|
+
puts '***********'
|
45
|
+
puts '***********'
|
46
|
+
puts '***********'
|
47
|
+
puts '***********'
|
48
|
+
p filename.split('.')
|
49
|
+
filename.split('.').last
|
50
|
+
rescue
|
51
|
+
nil
|
6
52
|
end
|
7
53
|
|
8
|
-
|
9
|
-
|
54
|
+
puts '$$$$$$$$$$$'
|
55
|
+
puts '$$$$$$$$$$$'
|
56
|
+
puts '$$$$$$$$$$$'
|
57
|
+
puts '$$$$$$$$$$$'
|
58
|
+
puts '$$$$$$$$$$$'
|
59
|
+
p options
|
60
|
+
if (infile = options[:infile] || ARGV.shift)
|
61
|
+
puts infile
|
62
|
+
input = File.read(infile)
|
10
63
|
else
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
64
|
+
input = STDIN.read
|
65
|
+
end
|
66
|
+
outfile = options[:outfile] || ARGV.shift
|
67
|
+
puts outfile
|
68
|
+
pipeline = Polytexnic::Pipeline.new(input, article: true)
|
69
|
+
format = options[:format] || format(outfile) || "html"
|
70
|
+
if format == "html"
|
71
|
+
output = pipeline.to_html
|
72
|
+
elsif format == "tex"
|
73
|
+
output = pipeline.to_polytex
|
74
|
+
else
|
75
|
+
raise ArgumentError, "Invalid format: #{format}"
|
76
|
+
end
|
77
|
+
if outfile
|
78
|
+
File.write(outfile, output)
|
79
|
+
else
|
80
|
+
puts output.strip
|
19
81
|
end
|
@@ -55,7 +55,6 @@ module Polytexnic
|
|
55
55
|
mainmatter(doc)
|
56
56
|
footnotes(doc)
|
57
57
|
table_of_contents(doc)
|
58
|
-
add_noindent(doc)
|
59
58
|
convert_to_html(doc)
|
60
59
|
end
|
61
60
|
|
@@ -96,7 +95,7 @@ module Polytexnic
|
|
96
95
|
def small_caps(doc)
|
97
96
|
doc.xpath('//hi[@rend="sc"]').each do |node|
|
98
97
|
node.name = 'span'
|
99
|
-
node['class'] = '
|
98
|
+
node['class'] = 'smallcaps'
|
100
99
|
node.remove_attribute('rend')
|
101
100
|
end
|
102
101
|
end
|
@@ -1399,27 +1398,34 @@ module Polytexnic
|
|
1399
1398
|
html << open << link.to_xhtml << '</li>'
|
1400
1399
|
end
|
1401
1400
|
|
1401
|
+
|
1402
|
+
# NOTE: The add_noindent method has been superseded by CSS rules as shown in the
|
1403
|
+
# softcover gem's epub.css files.
|
1404
|
+
# See div.chapter > p:first-of-type and related rules in
|
1405
|
+
# ./lib/softcover/article_template/epub/OEBPS/styles/epub.css
|
1406
|
+
# of the softcover gem's source.
|
1407
|
+
|
1402
1408
|
# Adds a noindent class where appropriate.
|
1403
1409
|
# The purpose is to give the designer the option to indent all paragraphs but the first
|
1404
1410
|
# one after the beginning of a chapter or section. The method is to add a "noindent" class
|
1405
1411
|
# in the first paragraph after each division (chapter, section, etc.).
|
1406
|
-
def add_noindent(doc)
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
end
|
1412
|
+
# def add_noindent(doc)
|
1413
|
+
# divisions = %w[chapter section subsection subsubsection]
|
1414
|
+
# divisions += divisions.map { |division| "#{division}-star"}
|
1415
|
+
# divisions.each do |type|
|
1416
|
+
# doc.css("div.#{type}").each do |node|
|
1417
|
+
# if (first_paragraph = node.at_css('p'))
|
1418
|
+
# if first_paragraph['class'] == 'noindent'
|
1419
|
+
# next
|
1420
|
+
# elsif first_paragraph['class'].nil?
|
1421
|
+
# first_paragraph['class'] = 'noindent'
|
1422
|
+
# else
|
1423
|
+
# first_paragraph['class'] += ' noindent'
|
1424
|
+
# end
|
1425
|
+
# end
|
1426
|
+
# end
|
1427
|
+
# end
|
1428
|
+
# end
|
1423
1429
|
|
1424
1430
|
# Cleans a node by removing all the given attributes.
|
1425
1431
|
def clean_node(node, attributes)
|
@@ -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/polytexnic.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = Polytexnic::VERSION
|
9
9
|
gem.authors = ["Michael Hartl", "Nick Merwin"]
|
10
10
|
gem.email = ["michael@softcover.io"]
|
11
|
-
gem.description = %q{Core translation engine for the
|
11
|
+
gem.description = %q{Core translation engine for the softcover gem}
|
12
12
|
gem.summary = %q{Convert from PolyTeX & Markdown to HTML & LaTeX}
|
13
13
|
gem.homepage = "https://polytexnic.org/"
|
14
14
|
gem.license = "MIT"
|
@@ -18,11 +18,11 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'nokogiri', '~> 1.8'
|
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', '
|
25
|
-
gem.add_dependency 'json', '~>
|
24
|
+
gem.add_dependency 'kramdown', '>= 1.17', '< 3.0'
|
25
|
+
gem.add_dependency 'json', '~> 2.3.0'
|
26
26
|
|
27
27
|
gem.add_development_dependency 'rspec', '~> 2.14'
|
28
28
|
gem.add_development_dependency 'simplecov', '~> 0.15.1'
|
data/spec/to_html/asides_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
32
32
|
<span class="number">Box 1.1.</span>
|
33
33
|
<span class="description">Lorem ipsum.</span>
|
34
34
|
</div>
|
35
|
-
<p
|
35
|
+
<p>lorem ipsum</p>
|
36
36
|
<p>dolor sit amet</p>
|
37
37
|
</div>
|
38
38
|
<p><a href="#aside-lorem" class="hyperref">Box <span class="ref">1.1</span></a></p>
|
@@ -76,4 +76,4 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
76
76
|
it { should include ">1<" }
|
77
77
|
end
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
@@ -202,7 +202,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
202
202
|
<h2><a href="#foo_baz" class="heading">Foo: baz</a></h2>
|
203
203
|
<div class="subsection-star">
|
204
204
|
<h3><a class="heading">Bar</a></h3>
|
205
|
-
<p
|
205
|
+
<p>Lorem ipsum</p>
|
206
206
|
</div>
|
207
207
|
</div>
|
208
208
|
<div id="cid1" data-tralics-id="cid1" class="section" data-number="1">
|
@@ -233,7 +233,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
233
233
|
should resemble <<-'EOS'
|
234
234
|
<div id="cha-foo_bar" data-tralics-id="cid1" class="chapter" data-number="1">
|
235
235
|
<h1><a href="#cha-foo_bar" class="heading"><span class="number">Chapter 1 </span>Foo</a></h1>
|
236
|
-
<p
|
236
|
+
<p><a href="#cha-foo_bar" class="hyperref">Chapter <span class="ref">1</span></a>
|
237
237
|
and
|
238
238
|
<a href="#cha-foo_baz" class="hyperref">Chapter <span class="ref">2</span></a>
|
239
239
|
</p>
|
@@ -241,7 +241,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
241
241
|
|
242
242
|
<div id="cha-foo_baz" data-tralics-id="cid2" class="chapter" data-number="2">
|
243
243
|
<h1><a href="#cha-foo_baz" class="heading"><span class="number">Chapter 2 </span>Baz</a></h1>
|
244
|
-
<p
|
244
|
+
<p><a href="#cha-foo_baz" class="hyperref">Chapter <span class="ref">2</span></a>
|
245
245
|
and
|
246
246
|
<a href="#cha-foo_bar" class="hyperref">Chapter <span class="ref">1</span></a>
|
247
247
|
</p>
|
@@ -270,13 +270,13 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
270
270
|
it do
|
271
271
|
should resemble <<-'EOS'
|
272
272
|
<div id="sec-foo" data-tralics-id="cid1" class="section" data-number="1"><h2><a href="#sec-foo" class="heading"><span class="number">1 </span>Foo</a></h2>
|
273
|
-
<p
|
273
|
+
<p>
|
274
274
|
<a href="#sec-bar" class="hyperref">Section <span class="ref">1.1</span></a>
|
275
275
|
and
|
276
276
|
<a href="#sec-baz" class="hyperref">Section <span class="ref">1.1.1</span></a>
|
277
277
|
</p>
|
278
278
|
<div id="sec-bar" data-tralics-id="uid1" class="subsection" data-number="1.1"><h3><a href="#sec-bar" class="heading"><span class="number">1.1 </span>Bar</a></h3>
|
279
|
-
<p
|
279
|
+
<p><a href="#sec-foo" class="hyperref">Section <span class="ref">1</span></a>
|
280
280
|
</p>
|
281
281
|
<div id="sec-baz" data-tralics-id="uid2" class="subsubsection" data-number="1.1.1">
|
282
282
|
<h4><a href="#sec-baz" class="heading">Baz</a></h4>
|
@@ -298,7 +298,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
298
298
|
should resemble <<-'EOS'
|
299
299
|
<div id="cha-foo" data-tralics-id="cid1" class="chapter" data-number="1">
|
300
300
|
<h1><a href="#cha-foo" class="heading"><span class="number">Chapter 1 </span>Foo</a></h1>
|
301
|
-
<p
|
301
|
+
<p><a href="#cha-bar" class="hyperref">Chapter <span class="undefined_ref">cha:bar</span></a>
|
302
302
|
</p>
|
303
303
|
</div>
|
304
304
|
EOS
|
@@ -324,7 +324,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
324
324
|
should resemble <<-'EOS'
|
325
325
|
<div id="frontmatter" data-number="0">
|
326
326
|
<div class="chapter-star" id="foo"><h1><a href="#foo" class="heading">Foo</a></h1>
|
327
|
-
<p
|
327
|
+
<p>Lorem ipsum.<sup id="cha-0_footnote-ref-1" class="footnote"><a href="#cha-0_footnote-1">1</a></sup></p>
|
328
328
|
</div></div>
|
329
329
|
|
330
330
|
<div id="cha-0_footnotes">
|
@@ -332,7 +332,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
332
332
|
<div id="cha-0_footnote-1" class="footnote"><a class="footnote-link" href="#cha-0_footnote-ref-1">1.</a> Foo bar.</div>
|
333
333
|
</div>
|
334
334
|
</div><div id="cha-bar" data-tralics-id="cid1" class="chapter" data-number="1"><h1><a href="#cha-bar" class="heading"><span class="number">Chapter 1 </span>Bar</a></h1>
|
335
|
-
<p
|
335
|
+
<p><a href="#cha-bar" class="hyperref">Chapter <span class="ref">1</span></a>
|
336
336
|
</p></div>
|
337
337
|
EOS
|
338
338
|
end
|
@@ -40,7 +40,7 @@ Listing~\ref{code:create_gemrc}
|
|
40
40
|
</div>
|
41
41
|
</div>
|
42
42
|
</div>
|
43
|
-
<p
|
43
|
+
<p><a href="#code-create_gemrc" class="hyperref">Listing <span class="ref">1.1</span></a></p>
|
44
44
|
</div>
|
45
45
|
EOS
|
46
46
|
end
|
@@ -121,4 +121,4 @@ Listing~\ref{code:create_gemrc}
|
|
121
121
|
expect { processed_text }.not_to raise_error
|
122
122
|
end
|
123
123
|
end
|
124
|
-
end
|
124
|
+
end
|
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}
|
@@ -108,6 +117,25 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
108
117
|
it { should_not resemble '<unknown>' }
|
109
118
|
end
|
110
119
|
|
120
|
+
describe "explicit noindent" do
|
121
|
+
let(:polytex) { '\noindent lorem ipsum' }
|
122
|
+
it { should resemble '<p class="noindent">lorem ipsum</p>' }
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "free span" do
|
126
|
+
let(:polytex) do <<-'EOS'
|
127
|
+
\chapter{Basics} % (fold)
|
128
|
+
\label{cha:basics}
|
129
|
+
|
130
|
+
%= <span class="free"></span>
|
131
|
+
EOS
|
132
|
+
end
|
133
|
+
|
134
|
+
it { should resemble('<span class="free"></span>') }
|
135
|
+
it { should_not resemble('<p><span class="free"></span></p>') }
|
136
|
+
end
|
137
|
+
|
138
|
+
|
111
139
|
describe '\maketitle' do
|
112
140
|
|
113
141
|
context "with all elements filled out explicitly" do
|
@@ -26,14 +26,14 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
26
26
|
<div id="cha-foo" data-tralics-id="cid1" class="chapter" data-number="1"><h1><a href="#cha-foo" class="heading"><span class="number">Chapter 1 </span>Foo <em>bar</em></a></h1>
|
27
27
|
</div>
|
28
28
|
<div id="sec-foobar" data-tralics-id="cid2" class="section" data-number="1.1"><h2><a href="#sec-foobar" class="heading"><span class="number">1.1 </span>Foobar</a></h2>
|
29
|
-
<p
|
29
|
+
<p>Lorem ipsum.<sup id="cha-1_footnote-ref-1" class="footnote"><a href="#cha-1_footnote-1">1</a></sup></p>
|
30
30
|
</div>
|
31
31
|
<div id="cha-1_footnotes">
|
32
32
|
<div class="footnotes">
|
33
33
|
<div id="cha-1_footnote-1" class="footnote"><a class="footnote-link" href="#cha-1_footnote-ref-1">1.</a> Cicero</div>
|
34
34
|
</div>
|
35
35
|
</div><div id="cha-bar" data-tralics-id="cid3" class="chapter" data-number="2"><h1><a href="#cha-bar" class="heading"><span class="number">Chapter 2 </span>Bar</a></h1>
|
36
|
-
<p
|
36
|
+
<p>Dolor sit amet.
|
37
37
|
</p></div>
|
38
38
|
EOS
|
39
39
|
end
|
@@ -66,14 +66,14 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
66
66
|
<div id="cha-foo" data-tralics-id="cid1" class="chapter" data-number="1"><h1><a href="#cha-foo" class="heading"><span class="number">Chapter 1 </span>Foo <em>bar</em></a></h1>
|
67
67
|
</div>
|
68
68
|
<div id="sec-foobar" data-tralics-id="cid2" class="section" data-number="1.1"><h2><a href="#sec-foobar" class="heading"><span class="number">1.1 </span>Foobar</a></h2>
|
69
|
-
<p
|
69
|
+
<p>Lorem ipsum.<sup id="cha-1_footnote-ref-1" class="footnote"><a href="#cha-1_footnote-1">1</a></sup></p>
|
70
70
|
</div>
|
71
71
|
<div id="cha-1_footnotes">
|
72
72
|
<div class="footnotes">
|
73
73
|
<div id="cha-1_footnote-1" class="footnote"><a class="footnote-link" href="#cha-1_footnote-ref-1">1.</a> Cicero</div>
|
74
74
|
</div>
|
75
75
|
</div><div id="cha-bar" data-tralics-id="cid3" class="chapter" data-number="2"><h1><a href="#cha-bar" class="heading"><span class="number">Chapter 2 </span>Bar</a></h1>
|
76
|
-
<p
|
76
|
+
<p>Dolor sit amet.<sup id="cha-2_footnote-ref-1" class="footnote"><a href="#cha-2_footnote-1">1</a></sup></p>
|
77
77
|
<p>Hey Jude.<sup id="cha-2_footnote-ref-2" class="footnote"><a href="#cha-2_footnote-2">2</a></sup>
|
78
78
|
</p></div><div id="cha-2_footnotes">
|
79
79
|
<div class="footnotes">
|
@@ -120,14 +120,14 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
120
120
|
<div id="cha-foo" data-tralics-id="cid1" class="chapter" data-number="1"><h1><a href="#cha-foo" class="heading"><span class="number">Chapter 1 </span>Foo <em>bar</em></a></h1>
|
121
121
|
</div>
|
122
122
|
<div id="sec-foobar" data-tralics-id="cid2" class="section" data-number="1.1"><h2><a href="#sec-foobar" class="heading"><span class="number">1.1 </span>Foobar</a></h2>
|
123
|
-
<p
|
123
|
+
<p>Lorem ipsum.<sup id="cha-1_footnote-ref-1" class="footnote"><a href="#cha-1_footnote-1">*</a></sup></p>
|
124
124
|
</div>
|
125
125
|
<div id="cha-1_footnotes">
|
126
126
|
<div class="footnotes nonumbers">
|
127
127
|
<div id="cha-1_footnote-1" class="footnote"><sup><a class="footnote-link" href="#cha-1_footnote-ref-1">*</a></sup> Cicero</div>
|
128
128
|
</div>
|
129
129
|
</div><div id="cha-bar" data-tralics-id="cid3" class="chapter" data-number="2"><h1><a href="#cha-bar" class="heading"><span class="number">Chapter 2 </span>Bar</a></h1>
|
130
|
-
<p
|
130
|
+
<p>Dolor sit amet.<sup id="cha-2_footnote-ref-1" class="footnote"><a href="#cha-2_footnote-1">*</a></sup></p>
|
131
131
|
<p>Hey Jude!<sup id="cha-2_footnote-ref-2" class="footnote intersentence"><a href="#cha-2_footnote-2">†</a></sup><span class="intersentencespace"></span> Be afraid.<span class="intersentencespace"></span> </p></div>
|
132
132
|
<div id="cha-2_footnotes">
|
133
133
|
<div class="footnotes nonumbers">
|
@@ -250,7 +250,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
250
250
|
<span class="description">This is another caption.</span>
|
251
251
|
</div>
|
252
252
|
</div>
|
253
|
-
<p
|
253
|
+
<p>
|
254
254
|
<a href="#fig-baz" class="hyperref">Figure <span class="ref">2.1</span></a>
|
255
255
|
</p>
|
256
256
|
</div>
|
@@ -268,7 +268,7 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
268
268
|
<span class="description">Yet another.</span>
|
269
269
|
</div>
|
270
270
|
</div>
|
271
|
-
<p
|
271
|
+
<p>
|
272
272
|
<a href="#fig-foo" class="hyperref">Figure <span class="ref">1.1</span></a>
|
273
273
|
and
|
274
274
|
<a href="#fig-bar" class="hyperref">Figure <span class="ref">1.2</span></a>
|
@@ -378,4 +378,4 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
378
378
|
end
|
379
379
|
end
|
380
380
|
end
|
381
|
-
end
|
381
|
+
end
|
@@ -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.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
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.10.8
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 1.10.8
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: pygments.rb
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,30 +57,36 @@ 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
|
73
79
|
requirements:
|
74
80
|
- - "~>"
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
82
|
+
version: 2.3.0
|
77
83
|
type: :runtime
|
78
84
|
prerelease: false
|
79
85
|
version_requirements: !ruby/object:Gem::Requirement
|
80
86
|
requirements:
|
81
87
|
- - "~>"
|
82
88
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
89
|
+
version: 2.3.0
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
91
|
name: rspec
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +115,7 @@ dependencies:
|
|
109
115
|
- - "~>"
|
110
116
|
- !ruby/object:Gem::Version
|
111
117
|
version: 0.15.1
|
112
|
-
description: Core translation engine for the
|
118
|
+
description: Core translation engine for the softcover gem
|
113
119
|
email:
|
114
120
|
- michael@softcover.io
|
115
121
|
executables:
|
@@ -209,6 +215,7 @@ files:
|
|
209
215
|
- ".pull_requests/1403381407"
|
210
216
|
- ".rspec"
|
211
217
|
- Gemfile
|
218
|
+
- Gemfile.lock
|
212
219
|
- Guardfile
|
213
220
|
- LICENSE.md
|
214
221
|
- README.md
|
@@ -295,8 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
302
|
- !ruby/object:Gem::Version
|
296
303
|
version: '0'
|
297
304
|
requirements: []
|
298
|
-
|
299
|
-
rubygems_version: 2.7.3
|
305
|
+
rubygems_version: 3.1.2
|
300
306
|
signing_key:
|
301
307
|
specification_version: 4
|
302
308
|
summary: Convert from PolyTeX & Markdown to HTML & LaTeX
|