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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d40834bb8a0205105739c3c347480faf14ddb63f64afeab9197e165d8b92bf5d
4
- data.tar.gz: c8571137c2be72affefe7ff6f4b40770e1e4fc52a4c67b6b7e1ea1e0cddf45a5
3
+ metadata.gz: 57e941e13dd5f01d451a691ddfe12b2c0aec374936b6d3ab7b3e87bbb40b0155
4
+ data.tar.gz: 8713119cd89cb0a3ed59c89fe75fef408b4e529b511759605fe10f37906e59bb
5
5
  SHA512:
6
- metadata.gz: 8d2d76d36ba1dcbb41f5db7bde576cccc23c8db83886ce9146885a0abee32be8827e172fe3f5670d160d2ca29d2e0d39ecca22464cb49c7c05ad666dd72f50e9
7
- data.tar.gz: 28688818b0a7ba361ad24c6e6cd7b807671e294cc0e8253e15b75c75bde1bfcf08e7401c258a3e1f80ccfbacf0e0dd7f338b17520bbe1f75bd00e8ee7c764379
6
+ metadata.gz: 9745a0ed12d9980abd3155373e12a8d34547346d75685a0c2e3ae2489a6a774e9e5804ad57eeebb545bc4a8bfe267704a069fc86995585cfa9907d4f78f96e8b
7
+ data.tar.gz: 2fa3da2933f7a818ffcb4e7ba34737b422ea26e4362fbf3263f0c2c3a57f986bc189b6af0b873e4f5ee5429bd0f22e6972b5af8656e546cf533c09e9b157fa81
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.7.0)
4
+ polytexnic (1.7.1)
5
5
  json (~> 2.3.0)
6
6
  kramdown (>= 2.0, < 3.0)
7
7
  msgpack (~> 1.2.0)
@@ -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)\S*?$)/m) do
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\}(\{.*?\})/m) do
285
+ output.gsub!(/\\begin\{longtable\}(\{.*?\})/) do
286
286
  "\\begin{table}\n\\begin{tabular}#{$1}"
287
287
  end
288
- output.gsub!(/((?:\\caption|\\label)\S*?$)\n\s*\\end\{longtable\}/) do
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.
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
@@ -178,12 +178,14 @@ describe 'Polytexnic::Pipeline#to_html' do
178
178
 
179
179
  describe "table environments" do
180
180
 
181
- context "longtable" do
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
- <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>
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'
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.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl