livetext 0.8.31 → 0.8.32
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/lib/livetext.rb +1 -1
- data/lib/standard.rb +34 -0
- data/test/data/table_with_heredocs/source.lt3 +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b44756af395f11daf846eab2e16442463ac8e68
|
4
|
+
data.tar.gz: a6e7b003814945f84e813bb20d619ff3700b5cfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf8a6f59b30bdd36ea5406587c7055a65a32b852235fc36cc65e00f732edd9944a2438212780c037f4224c5c1ba74a75c60f788403cb873fbed1b60c80fb7856
|
7
|
+
data.tar.gz: d19ed8a6ef7d97e7791c12cb80858093bbcb5a5611967508acbc783e3e93ddaebb0707392a8cd36cf1d87984ae6d5b1030afd9f040dbebf975e0ba620cc9c979
|
data/lib/livetext.rb
CHANGED
data/lib/standard.rb
CHANGED
@@ -296,4 +296,38 @@ module Livetext::Standard
|
|
296
296
|
_puts "<a href='#{url}'>#{text}</a>"
|
297
297
|
end
|
298
298
|
|
299
|
+
def xtable # Borrowed from bookish - FIXME
|
300
|
+
# @table_num ||= 0
|
301
|
+
# @table_num += 1
|
302
|
+
title = @_data
|
303
|
+
delim = " :: "
|
304
|
+
_puts "<br><center><table border=1 width=90% cellpadding=5>"
|
305
|
+
lines = _body(true)
|
306
|
+
maxw = nil
|
307
|
+
sep = "\030"
|
308
|
+
lines.each do |line|
|
309
|
+
_formatting(line)
|
310
|
+
line.gsub!("\n", sep)
|
311
|
+
cells = line.split(delim)
|
312
|
+
wide = cells.map {|x| x.length }
|
313
|
+
maxw = [0] * cells.size
|
314
|
+
maxw = maxw.map.with_index {|x, i| [x, wide[i]].max }
|
315
|
+
end
|
316
|
+
|
317
|
+
sum = maxw.inject(0, :+)
|
318
|
+
maxw.map! {|x| (x/sum*100).floor }
|
319
|
+
|
320
|
+
lines.each do |line|
|
321
|
+
cells = line.split(delim)
|
322
|
+
_puts "<tr>"
|
323
|
+
cell.gsub!(sep, "\n")
|
324
|
+
cells.each.with_index {|cell, i| ; _puts " <td>#{cell}</td>" }
|
325
|
+
_puts "</tr>"
|
326
|
+
end
|
327
|
+
_puts "</table>"
|
328
|
+
# @toc << "#{_nbsp(8)}<b>Table #@chapter.#@table_num</b> #{title}<br>"
|
329
|
+
# _next_output(_slug("table_#{title}"))
|
330
|
+
# _puts "<b>Table #@chapter.#@table_num #{title}</b></center><br>"
|
331
|
+
end
|
332
|
+
|
299
333
|
end
|