polytexnic 1.5.14 → 1.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/polytexnic/postprocessors/html.rb +24 -18
- data/lib/polytexnic/version.rb +1 -1
- data/polytexnic.gemspec +1 -1
- 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 +19 -0
- data/spec/to_html/footnote_spec.rb +6 -6
- data/spec/to_html/graphics_and_figures_spec.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 658a70a77afa54b8e643d68cfdf54d91119193ec2f31950eab313a6e1368ce95
|
4
|
+
data.tar.gz: 1d8ccad2438d6cf9b3d81f079c0c6b74e80bf0d3a3eb191f8a154f72143690ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca58630eba2304c132e5d3ee21d4de35df0bce99e37acc3ce164b712155f9a36476bb1ad6613d3920871b2b69a421c58637d6649061806cb93703ff1064f54c2
|
7
|
+
data.tar.gz: 348eeb92774d793146f981a9af82d698e14b2bcbb0bba3303e6be066acb76cbedb6340ea887f9d393b1ca6d9c3080f7617254110196f8d4cf815833291dac045
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.5.
|
4
|
+
polytexnic (1.5.15)
|
5
5
|
json (~> 1.8.1)
|
6
6
|
kramdown (~> 1.17)
|
7
7
|
msgpack (~> 1.2.0)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
ffi (1.12.2)
|
29
29
|
formatador (0.2.5)
|
30
30
|
growl (1.0.3)
|
31
|
-
guard (2.16.
|
31
|
+
guard (2.16.2)
|
32
32
|
formatador (>= 0.2.4)
|
33
33
|
listen (>= 2.7, < 4.0)
|
34
34
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
49
49
|
rb-inotify (~> 0.9, >= 0.9.10)
|
50
50
|
lumberjack (1.2.4)
|
51
|
-
method_source (0.
|
51
|
+
method_source (1.0.0)
|
52
52
|
mime-types (3.3.1)
|
53
53
|
mime-types-data (~> 3.2015)
|
54
54
|
mime-types-data (3.2019.1009)
|
@@ -56,14 +56,14 @@ GEM
|
|
56
56
|
msgpack (1.2.10)
|
57
57
|
multi_json (1.14.1)
|
58
58
|
nenv (0.3.0)
|
59
|
-
nokogiri (1.10.
|
59
|
+
nokogiri (1.10.9)
|
60
60
|
mini_portile2 (~> 2.4.0)
|
61
61
|
notiffany (0.1.3)
|
62
62
|
nenv (~> 0.1)
|
63
63
|
shellany (~> 0.0)
|
64
|
-
pry (0.
|
65
|
-
coderay (~> 1.1
|
66
|
-
method_source (~>
|
64
|
+
pry (0.13.0)
|
65
|
+
coderay (~> 1.1)
|
66
|
+
method_source (~> 1.0)
|
67
67
|
pygments.rb (1.2.1)
|
68
68
|
multi_json (>= 1.0.0)
|
69
69
|
rake (13.0.1)
|
@@ -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
|
|
@@ -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)
|
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"
|
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
@@ -108,6 +108,25 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
108
108
|
it { should_not resemble '<unknown>' }
|
109
109
|
end
|
110
110
|
|
111
|
+
describe "explicit noindent" do
|
112
|
+
let(:polytex) { '\noindent lorem ipsum' }
|
113
|
+
it { should resemble '<p class="noindent">lorem ipsum</p>' }
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "free span" do
|
117
|
+
let(:polytex) do <<-'EOS'
|
118
|
+
\chapter{Basics} % (fold)
|
119
|
+
\label{cha:basics}
|
120
|
+
|
121
|
+
%= <span class="free"></span>
|
122
|
+
EOS
|
123
|
+
end
|
124
|
+
|
125
|
+
it { should resemble('<span class="free"></span>') }
|
126
|
+
it { should_not resemble('<p><span class="free"></span></p>') }
|
127
|
+
end
|
128
|
+
|
129
|
+
|
111
130
|
describe '\maketitle' do
|
112
131
|
|
113
132
|
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
|
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.5.
|
4
|
+
version: 1.5.15
|
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-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 0.15.1
|
112
|
-
description: Core translation engine for the
|
112
|
+
description: Core translation engine for the softcover gem
|
113
113
|
email:
|
114
114
|
- michael@softcover.io
|
115
115
|
executables:
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
- !ruby/object:Gem::Version
|
297
297
|
version: '0'
|
298
298
|
requirements: []
|
299
|
-
rubygems_version: 3.
|
299
|
+
rubygems_version: 3.1.2
|
300
300
|
signing_key:
|
301
301
|
specification_version: 4
|
302
302
|
summary: Convert from PolyTeX & Markdown to HTML & LaTeX
|