polytexnic 1.6.6 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +14 -20
- data/lib/polytexnic/postprocessors/html.rb +3 -1
- data/lib/polytexnic/preprocessors/html.rb +11 -3
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/table_spec.rb +86 -17
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f107f6c8ed8c8ab715b2884c258ae3e8e2d723f2ee7ad38187df24d9b3ea760
|
4
|
+
data.tar.gz: 1c334bb78f696c00cb01c658b433b011fb5dcde1079a1f3526f9c342d346a31c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87e233ea55a9055fa682c9b1868cabf98a85b8c2e823b869aca8fdce5e77035a5d0f7999cafa56276becc48cdeb71c86a38b40160e00bed2cd948b54271fa4c
|
7
|
+
data.tar.gz: b0cda74d69d07212f9d0b928e851e1d2492d9838abc3484080539ecacb5a54a4e6772cfb730156edcd7e79ac99a2840a9173b2beb4bc8d2bd57833cad1ac32d6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.
|
4
|
+
polytexnic (1.7.2)
|
5
5
|
json (~> 2.3.0)
|
6
6
|
kramdown (>= 2.0, < 3.0)
|
7
7
|
msgpack (~> 1.2.0)
|
@@ -12,21 +12,16 @@ GEM
|
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
14
|
coderay (1.1.3)
|
15
|
-
columnize (0.9.0)
|
16
15
|
coveralls (0.7.2)
|
17
16
|
multi_json (~> 1.3)
|
18
17
|
rest-client (= 1.6.7)
|
19
18
|
simplecov (>= 0.7)
|
20
19
|
term-ansicolor (= 1.2.2)
|
21
20
|
thor (= 0.18.1)
|
22
|
-
|
23
|
-
debugger2 (1.0.0.beta2)
|
24
|
-
columnize (>= 0.3.1)
|
25
|
-
debugger-linecache (~> 1.2.0)
|
26
|
-
diff-lcs (1.4.4)
|
21
|
+
diff-lcs (1.5.0)
|
27
22
|
docile (1.1.5)
|
28
|
-
ffi (1.15.
|
29
|
-
formatador (
|
23
|
+
ffi (1.15.5)
|
24
|
+
formatador (1.1.0)
|
30
25
|
growl (1.0.3)
|
31
26
|
guard (2.18.0)
|
32
27
|
formatador (>= 0.2.4)
|
@@ -43,20 +38,20 @@ GEM
|
|
43
38
|
guard-compat (~> 1.1)
|
44
39
|
rspec (>= 2.99.0, < 4.0)
|
45
40
|
json (2.3.1)
|
46
|
-
kramdown (2.3.
|
41
|
+
kramdown (2.3.2)
|
47
42
|
rexml
|
48
|
-
listen (3.7.
|
43
|
+
listen (3.7.1)
|
49
44
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
50
45
|
rb-inotify (~> 0.9, >= 0.9.10)
|
51
46
|
lumberjack (1.2.8)
|
52
47
|
method_source (1.0.0)
|
53
|
-
mime-types (3.
|
48
|
+
mime-types (3.4.1)
|
54
49
|
mime-types-data (~> 3.2015)
|
55
|
-
mime-types-data (3.
|
50
|
+
mime-types-data (3.2022.0105)
|
56
51
|
msgpack (1.2.10)
|
57
52
|
multi_json (1.15.0)
|
58
53
|
nenv (0.3.0)
|
59
|
-
nokogiri (1.
|
54
|
+
nokogiri (1.13.3-x86_64-darwin)
|
60
55
|
racc (~> 1.4)
|
61
56
|
notiffany (0.1.3)
|
62
57
|
nenv (~> 0.1)
|
@@ -64,10 +59,10 @@ GEM
|
|
64
59
|
pry (0.14.1)
|
65
60
|
coderay (~> 1.1)
|
66
61
|
method_source (~> 1.0)
|
67
|
-
pygments.rb (2.
|
68
|
-
racc (1.
|
62
|
+
pygments.rb (2.3.0)
|
63
|
+
racc (1.6.0)
|
69
64
|
rake (13.0.6)
|
70
|
-
rb-fsevent (0.11.
|
65
|
+
rb-fsevent (0.11.1)
|
71
66
|
rb-inotify (0.10.1)
|
72
67
|
ffi (~> 1.0)
|
73
68
|
rest-client (1.6.7)
|
@@ -93,11 +88,10 @@ GEM
|
|
93
88
|
tins (0.13.2)
|
94
89
|
|
95
90
|
PLATFORMS
|
96
|
-
x86_64-darwin-
|
91
|
+
x86_64-darwin-19
|
97
92
|
|
98
93
|
DEPENDENCIES
|
99
94
|
coveralls
|
100
|
-
debugger2
|
101
95
|
growl
|
102
96
|
guard-rspec
|
103
97
|
polytexnic!
|
@@ -106,4 +100,4 @@ DEPENDENCIES
|
|
106
100
|
simplecov (~> 0.15.1)
|
107
101
|
|
108
102
|
BUNDLED WITH
|
109
|
-
2.
|
103
|
+
2.3.10
|
@@ -792,7 +792,9 @@ module Polytexnic
|
|
792
792
|
doc.xpath('//thinspace').each do |node|
|
793
793
|
node.name = 'span'
|
794
794
|
node['class'] = 'thinspace'
|
795
|
-
|
795
|
+
#   replaces  , which stopped working for some reason.
|
796
|
+
# Weirdly, it still works in the corresponding test.
|
797
|
+
node.inner_html = ' '
|
796
798
|
end
|
797
799
|
doc.xpath('//normalspace').each do |node|
|
798
800
|
node.replace(' ')
|
@@ -28,11 +28,11 @@ module Polytexnic
|
|
28
28
|
hyperrefs(output)
|
29
29
|
title_fields(output)
|
30
30
|
maketitle(output)
|
31
|
+
convert_longtable(output)
|
31
32
|
label_names(output)
|
32
33
|
image_names(output)
|
33
34
|
restore_eq_labels(output)
|
34
35
|
convert_float_centering(output)
|
35
|
-
convert_longtable(output)
|
36
36
|
mark_environments(output)
|
37
37
|
make_tabular_alignment_cache(output)
|
38
38
|
cache_unicode(output)
|
@@ -279,8 +279,16 @@ module Polytexnic
|
|
279
279
|
# input documents. The latest update includes support for the tabularx
|
280
280
|
# environment
|
281
281
|
def convert_longtable(output)
|
282
|
-
output.gsub!(
|
283
|
-
|
282
|
+
output.gsub!(/\\begin\{longtable\}(\{.*?\})\n\s*((?:\\caption|\\label).*?)\\\\$/) do
|
283
|
+
"\\begin{table}\n#{$2}\n\\begin{tabular}#{$1}"
|
284
|
+
end
|
285
|
+
output.gsub!(/\\begin\{longtable\}(\{.*?\})/) do
|
286
|
+
"\\begin{table}\n\\begin{tabular}#{$1}"
|
287
|
+
end
|
288
|
+
output.gsub!(/((?:\\caption|\\label).*?$)\n\s*\\end\{longtable\}/) do
|
289
|
+
"\\end{tabular}#{$1}\n\\end{table}"
|
290
|
+
end
|
291
|
+
output.gsub!('\end{longtable}', "\\end{tabular}\n\\end{table}")
|
284
292
|
output.gsub!(/\\begin\{tabularx\}\{.*?\}\{(.*)\}/) do
|
285
293
|
alignment = $1.gsub('X', 'l') # X becomes left-justified in HTML
|
286
294
|
"\\begin{tabular}{#{alignment}}"
|
data/lib/polytexnic/version.rb
CHANGED
data/spec/to_html/table_spec.rb
CHANGED
@@ -33,22 +33,6 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it { should resemble output }
|
36
|
-
|
37
|
-
context "longtable" do
|
38
|
-
|
39
|
-
let(:polytex) do <<-'EOS'
|
40
|
-
\begin{longtable}{cc}
|
41
|
-
\hline
|
42
|
-
HTTP request & URL \\
|
43
|
-
\hline
|
44
|
-
GET & /users \\
|
45
|
-
GET & /users/1
|
46
|
-
\end{longtable}
|
47
|
-
EOS
|
48
|
-
end
|
49
|
-
|
50
|
-
it { should resemble output }
|
51
|
-
end
|
52
36
|
end
|
53
37
|
|
54
38
|
context "tabularx environments" do
|
@@ -194,6 +178,91 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
194
178
|
|
195
179
|
describe "table environments" do
|
196
180
|
|
181
|
+
context "longtable" do
|
182
|
+
|
183
|
+
context "with caption on top" do
|
184
|
+
|
185
|
+
let(:polytex) do <<-'EOS'
|
186
|
+
|
187
|
+
\begin{longtable}{cc}
|
188
|
+
\caption{Test caption.\label{table:longtable}}\\
|
189
|
+
HTTP request & URL \\
|
190
|
+
GET & /users \\
|
191
|
+
GET & /users/1
|
192
|
+
\end{longtable}
|
193
|
+
|
194
|
+
Table~\ref{table:longtable}
|
195
|
+
|
196
|
+
EOS
|
197
|
+
end
|
198
|
+
|
199
|
+
let(:output) do <<-'EOS'
|
200
|
+
<div id="table-longtable" data-tralics-id="uid1" data-number="1" class="table">
|
201
|
+
<table class="tabular">
|
202
|
+
<tr><td class="align_center">HTTP request</td>
|
203
|
+
<td class="align_center">URL</td>
|
204
|
+
</tr><tr><td class="align_center">GET</td>
|
205
|
+
<td class="align_center">/users</td>
|
206
|
+
</tr><tr><td class="align_center">GET</td>
|
207
|
+
<td class="align_center">/users/1</td>
|
208
|
+
</tr></table>
|
209
|
+
<div class="caption">
|
210
|
+
<span class="header">Table 1: </span>
|
211
|
+
<span class="description">Test caption.
|
212
|
+
</span>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
<p>
|
216
|
+
<a href="#table-longtable" class="hyperref">Table <span class="ref">1</span></a>
|
217
|
+
</p>
|
218
|
+
EOS
|
219
|
+
end
|
220
|
+
|
221
|
+
it { should resemble output }
|
222
|
+
end
|
223
|
+
|
224
|
+
context "with caption on bottom" do
|
225
|
+
|
226
|
+
let(:polytex) do <<-'EOS'
|
227
|
+
|
228
|
+
\begin{longtable}{cc}
|
229
|
+
HTTP request & URL \\
|
230
|
+
GET & /users \\
|
231
|
+
GET & /users/1
|
232
|
+
\caption{Test caption.\label{table:longtable}}
|
233
|
+
\end{longtable}
|
234
|
+
|
235
|
+
Table~\ref{table:longtable}
|
236
|
+
|
237
|
+
EOS
|
238
|
+
end
|
239
|
+
|
240
|
+
let(:output) do <<-'EOS'
|
241
|
+
<div id="table-longtable" data-tralics-id="uid1" data-number="1" class="table">
|
242
|
+
<table class="tabular">
|
243
|
+
<tr><td class="align_center">HTTP request</td>
|
244
|
+
<td class="align_center">URL</td>
|
245
|
+
</tr><tr><td class="align_center">GET</td>
|
246
|
+
<td class="align_center">/users</td>
|
247
|
+
</tr><tr><td class="align_center">GET</td>
|
248
|
+
<td class="align_center">/users/1</td>
|
249
|
+
</tr></table>
|
250
|
+
<div class="caption">
|
251
|
+
<span class="header">Table 1: </span>
|
252
|
+
<span class="description">Test caption.
|
253
|
+
</span>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<p>
|
257
|
+
<a href="#table-longtable" class="hyperref">Table <span class="ref">1</span></a>
|
258
|
+
</p>
|
259
|
+
EOS
|
260
|
+
end
|
261
|
+
|
262
|
+
it { should resemble output }
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
197
266
|
context "with a label and a cross-reference" do
|
198
267
|
let(:polytex) do <<-'EOS'
|
199
268
|
\begin{table}
|
@@ -352,4 +421,4 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
352
421
|
|
353
422
|
end
|
354
423
|
end
|
355
|
-
end
|
424
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polytexnic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
8
8
|
- Nick Merwin
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -293,7 +293,7 @@ homepage: https://github.com/softcover/polytexnic
|
|
293
293
|
licenses:
|
294
294
|
- MIT
|
295
295
|
metadata: {}
|
296
|
-
post_install_message:
|
296
|
+
post_install_message:
|
297
297
|
rdoc_options: []
|
298
298
|
require_paths:
|
299
299
|
- lib
|
@@ -308,8 +308,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
308
|
- !ruby/object:Gem::Version
|
309
309
|
version: '0'
|
310
310
|
requirements: []
|
311
|
-
rubygems_version: 3.
|
312
|
-
signing_key:
|
311
|
+
rubygems_version: 3.3.7
|
312
|
+
signing_key:
|
313
313
|
specification_version: 4
|
314
314
|
summary: Convert from PolyTeX & Markdown to HTML & LaTeX
|
315
315
|
test_files:
|