polytexnic 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/polytexnic/preprocessors/html.rb +3 -5
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/table_spec.rb +64 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e941e13dd5f01d451a691ddfe12b2c0aec374936b6d3ab7b3e87bbb40b0155
|
4
|
+
data.tar.gz: 8713119cd89cb0a3ed59c89fe75fef408b4e529b511759605fe10f37906e59bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9745a0ed12d9980abd3155373e12a8d34547346d75685a0c2e3ae2489a6a774e9e5804ad57eeebb545bc4a8bfe267704a069fc86995585cfa9907d4f78f96e8b
|
7
|
+
data.tar.gz: 2fa3da2933f7a818ffcb4e7ba34737b422ea26e4362fbf3263f0c2c3a57f986bc189b6af0b873e4f5ee5429bd0f22e6972b5af8656e546cf533c09e9b157fa81
|
data/Gemfile.lock
CHANGED
@@ -279,13 +279,13 @@ 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!(/\\begin\{longtable\}(\{.*?\})\n((?:\\caption|\\label)
|
282
|
+
output.gsub!(/\\begin\{longtable\}(\{.*?\})\n\s*((?:\\caption|\\label).*?)\\\\$/) do
|
283
283
|
"\\begin{table}\n#{$2}\n\\begin{tabular}#{$1}"
|
284
284
|
end
|
285
|
-
output.gsub!(/\\begin\{longtable\}(\{.*?\})/
|
285
|
+
output.gsub!(/\\begin\{longtable\}(\{.*?\})/) do
|
286
286
|
"\\begin{table}\n\\begin{tabular}#{$1}"
|
287
287
|
end
|
288
|
-
output.gsub!(/((?:\\caption|\\label)
|
288
|
+
output.gsub!(/((?:\\caption|\\label).*?$)\n\s*\\end\{longtable\}/) do
|
289
289
|
"\\end{tabular}#{$1}\n\\end{table}"
|
290
290
|
end
|
291
291
|
output.gsub!('\end{longtable}', "\\end{tabular}\n\\end{table}")
|
@@ -294,8 +294,6 @@ module Polytexnic
|
|
294
294
|
"\\begin{tabular}{#{alignment}}"
|
295
295
|
end
|
296
296
|
output.gsub!('\end{tabularx}', '\end{tabular}')
|
297
|
-
# puts output
|
298
|
-
# puts '+' * 50
|
299
297
|
end
|
300
298
|
|
301
299
|
# Marks environments with their types.
|
data/lib/polytexnic/version.rb
CHANGED
data/spec/to_html/table_spec.rb
CHANGED
@@ -178,12 +178,14 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
178
178
|
|
179
179
|
describe "table environments" do
|
180
180
|
|
181
|
-
|
181
|
+
context "longtable" do
|
182
|
+
|
183
|
+
context "with caption on top" do
|
182
184
|
|
183
185
|
let(:polytex) do <<-'EOS'
|
184
186
|
|
185
187
|
\begin{longtable}{cc}
|
186
|
-
\label{table:longtable}
|
188
|
+
\caption{Test caption.\label{table:longtable}}\\
|
187
189
|
HTTP request & URL \\
|
188
190
|
GET & /users \\
|
189
191
|
GET & /users/1
|
@@ -195,24 +197,71 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
195
197
|
end
|
196
198
|
|
197
199
|
let(:output) do <<-'EOS'
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
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>
|
211
259
|
EOS
|
212
260
|
end
|
213
261
|
|
214
262
|
it { should resemble output }
|
215
263
|
end
|
264
|
+
end
|
216
265
|
|
217
266
|
context "with a label and a cross-reference" do
|
218
267
|
let(:polytex) do <<-'EOS'
|