polytexnic 1.6.6 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -11
- data/lib/polytexnic/postprocessors/html.rb +3 -1
- data/lib/polytexnic/preprocessors/html.rb +13 -3
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/table_spec.rb +37 -17
- 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: d40834bb8a0205105739c3c347480faf14ddb63f64afeab9197e165d8b92bf5d
|
4
|
+
data.tar.gz: c8571137c2be72affefe7ff6f4b40770e1e4fc52a4c67b6b7e1ea1e0cddf45a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2d76d36ba1dcbb41f5db7bde576cccc23c8db83886ce9146885a0abee32be8827e172fe3f5670d160d2ca29d2e0d39ecca22464cb49c7c05ad666dd72f50e9
|
7
|
+
data.tar.gz: 28688818b0a7ba361ad24c6e6cd7b807671e294cc0e8253e15b75c75bde1bfcf08e7401c258a3e1f80ccfbacf0e0dd7f338b17520bbe1f75bd00e8ee7c764379
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.
|
4
|
+
polytexnic (1.7.0)
|
5
5
|
json (~> 2.3.0)
|
6
6
|
kramdown (>= 2.0, < 3.0)
|
7
7
|
msgpack (~> 1.2.0)
|
@@ -23,10 +23,10 @@ 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.5.0)
|
27
27
|
docile (1.1.5)
|
28
|
-
ffi (1.15.
|
29
|
-
formatador (
|
28
|
+
ffi (1.15.5)
|
29
|
+
formatador (1.1.0)
|
30
30
|
growl (1.0.3)
|
31
31
|
guard (2.18.0)
|
32
32
|
formatador (>= 0.2.4)
|
@@ -45,18 +45,18 @@ GEM
|
|
45
45
|
json (2.3.1)
|
46
46
|
kramdown (2.3.1)
|
47
47
|
rexml
|
48
|
-
listen (3.7.
|
48
|
+
listen (3.7.1)
|
49
49
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
50
50
|
rb-inotify (~> 0.9, >= 0.9.10)
|
51
51
|
lumberjack (1.2.8)
|
52
52
|
method_source (1.0.0)
|
53
|
-
mime-types (3.
|
53
|
+
mime-types (3.4.1)
|
54
54
|
mime-types-data (~> 3.2015)
|
55
|
-
mime-types-data (3.
|
55
|
+
mime-types-data (3.2022.0105)
|
56
56
|
msgpack (1.2.10)
|
57
57
|
multi_json (1.15.0)
|
58
58
|
nenv (0.3.0)
|
59
|
-
nokogiri (1.
|
59
|
+
nokogiri (1.13.2-x86_64-darwin)
|
60
60
|
racc (~> 1.4)
|
61
61
|
notiffany (0.1.3)
|
62
62
|
nenv (~> 0.1)
|
@@ -64,10 +64,10 @@ GEM
|
|
64
64
|
pry (0.14.1)
|
65
65
|
coderay (~> 1.1)
|
66
66
|
method_source (~> 1.0)
|
67
|
-
pygments.rb (2.
|
68
|
-
racc (1.
|
67
|
+
pygments.rb (2.3.0)
|
68
|
+
racc (1.6.0)
|
69
69
|
rake (13.0.6)
|
70
|
-
rb-fsevent (0.11.
|
70
|
+
rb-fsevent (0.11.1)
|
71
71
|
rb-inotify (0.10.1)
|
72
72
|
ffi (~> 1.0)
|
73
73
|
rest-client (1.6.7)
|
@@ -93,6 +93,7 @@ GEM
|
|
93
93
|
tins (0.13.2)
|
94
94
|
|
95
95
|
PLATFORMS
|
96
|
+
x86_64-darwin-19
|
96
97
|
x86_64-darwin-20
|
97
98
|
|
98
99
|
DEPENDENCIES
|
@@ -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,13 +279,23 @@ 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((?:\\caption|\\label)\S*?$)/m) do
|
283
|
+
"\\begin{table}\n#{$2}\n\\begin{tabular}#{$1}"
|
284
|
+
end
|
285
|
+
output.gsub!(/\\begin\{longtable\}(\{.*?\})/m) do
|
286
|
+
"\\begin{table}\n\\begin{tabular}#{$1}"
|
287
|
+
end
|
288
|
+
output.gsub!(/((?:\\caption|\\label)\S*?$)\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}}"
|
287
295
|
end
|
288
296
|
output.gsub!('\end{tabularx}', '\end{tabular}')
|
297
|
+
# puts output
|
298
|
+
# puts '+' * 50
|
289
299
|
end
|
290
300
|
|
291
301
|
# Marks environments with their types.
|
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,42 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
194
178
|
|
195
179
|
describe "table environments" do
|
196
180
|
|
181
|
+
context "longtable" do
|
182
|
+
|
183
|
+
let(:polytex) do <<-'EOS'
|
184
|
+
|
185
|
+
\begin{longtable}{cc}
|
186
|
+
\label{table:longtable}
|
187
|
+
HTTP request & URL \\
|
188
|
+
GET & /users \\
|
189
|
+
GET & /users/1
|
190
|
+
\end{longtable}
|
191
|
+
|
192
|
+
Table~\ref{table:longtable}
|
193
|
+
|
194
|
+
EOS
|
195
|
+
end
|
196
|
+
|
197
|
+
let(:output) do <<-'EOS'
|
198
|
+
<div id="table-longtable" data-tralics-id="uid1" data-number="1" class="table">
|
199
|
+
<table class="tabular"><tr><td class="align_center">HTTP request</td>
|
200
|
+
<td class="align_center">URL</td>
|
201
|
+
</tr><tr><td class="align_center">GET</td>
|
202
|
+
<td class="align_center">/users</td>
|
203
|
+
</tr><tr><td class="align_center">GET</td>
|
204
|
+
<td class="align_center">/users/1</td>
|
205
|
+
</tr></table>
|
206
|
+
<div class="caption">
|
207
|
+
<span class="header">Table 1</span>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
<p><a href="#table-longtable" class="hyperref">Table <span class="ref">1</span></a></p>
|
211
|
+
EOS
|
212
|
+
end
|
213
|
+
|
214
|
+
it { should resemble output }
|
215
|
+
end
|
216
|
+
|
197
217
|
context "with a label and a cross-reference" do
|
198
218
|
let(:polytex) do <<-'EOS'
|
199
219
|
\begin{table}
|
@@ -352,4 +372,4 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
352
372
|
|
353
373
|
end
|
354
374
|
end
|
355
|
-
end
|
375
|
+
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.
|
4
|
+
version: 1.7.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:
|
12
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|