livetext 0.9.42 → 0.9.43
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/standard.rb +76 -9
- data/lib/livetext/version.rb +1 -1
- 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: 2eecc4b7aec5571c91f72cdba9b7d2e3ab43c7caf3f079ba336ccc112d4a4939
|
|
4
|
+
data.tar.gz: d3556ab21ab322f054c0aae264a8e2c833f61f1baa69bb5a965d4b418bf08c58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 665b6c06e3f9469a7f98c1e4b6b9a7a4fad55d7a554811d4c92a63757a7ec2d44f33f4468ea2d709896d4bcc4cadb8a1a7f95fdacb2533982a552c133116bbd3
|
|
7
|
+
data.tar.gz: 7f391f554863d8411fd3523a09029419914dd8d8df66df1ac5bc2e0186060b543977c46c9e4bbe59343cb8dfa78263c81ff876f8732811b1ed2caa33fb41f05a
|
data/lib/livetext/standard.rb
CHANGED
|
@@ -179,18 +179,55 @@ module Livetext::Standard
|
|
|
179
179
|
api.optional_blank_line
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
+
=begin
|
|
183
|
+
Filename: foobar
|
|
184
|
+
get_globals - 1 - transforming /private/tmp/.blogs/views/foobar/data/global.lt3
|
|
185
|
+
|
|
186
|
+
>> variables: fdir = /private/tmp/.blogs/views/foobar/data/
|
|
187
|
+
fname = ../settings/view.txt
|
|
188
|
+
path = /private/tmp/.blogs/views/foobar/data/../settings/view.txt
|
|
189
|
+
|
|
190
|
+
rpath = /private/tmp/.blogs/views/foobar/settings/view.txt
|
|
191
|
+
path = /private/tmp/.blogs/views/foobar/settings/view.txt
|
|
192
|
+
dir = /private/tmp/.blogs/views/foobar/settings
|
|
193
|
+
base = view.txt
|
|
194
|
+
|
|
195
|
+
>> variables: fdir = /private/tmp/.blogs/views/foobar/data/
|
|
196
|
+
fname = ../settings/recent.txt
|
|
197
|
+
path = /private/tmp/.blogs/views/foobar/data/../settings/recent.txt
|
|
198
|
+
rpath = /private/tmp/.blogs/views/foobar/settings/recent.txt
|
|
199
|
+
path = /private/tmp/.blogs/views/foobar/settings/recent.txt
|
|
200
|
+
dir = /private/tmp/.blogs/views/foobar/settings
|
|
201
|
+
base = recent.txt
|
|
202
|
+
|
|
203
|
+
>> variables: fdir = /private/tmp/.blogs/views/foobar/data/
|
|
204
|
+
fname = ../settings/publish.txt
|
|
205
|
+
path = /private/tmp/.blogs/views/foobar/data/../settings/publish.txt
|
|
206
|
+
rpath = /private/tmp/.blogs/views/foobar/settings/publish.txt
|
|
207
|
+
path = /private/tmp/.blogs/views/foobar/settings/publish.txt
|
|
208
|
+
dir = /private/tmp/.blogs/views/foobar/settings
|
|
209
|
+
base = publish.txt
|
|
210
|
+
|
|
211
|
+
get_globals - 2
|
|
212
|
+
|
|
213
|
+
=end
|
|
214
|
+
|
|
182
215
|
def variables(args = nil, body = nil)
|
|
183
216
|
prefix = api.args[0]
|
|
184
|
-
|
|
185
|
-
puts ">> variables: pre=#{prefix.inspect} file=#{file.inspect} pwd=#{Dir.pwd}"
|
|
217
|
+
fname = api.args[1]
|
|
186
218
|
prefix = nil if prefix == "-" # FIXME dumb hack
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
219
|
+
fdir = ::Livetext::Vars[:FileDir] + "/" # where is the file we are reading?
|
|
220
|
+
if fname
|
|
221
|
+
path0 = fdir + fname
|
|
222
|
+
# puts ">> variables: fdir = #{fdir} fname = #{fname} path = #{path0}"
|
|
223
|
+
pname = Pathname.new(path0)
|
|
224
|
+
rpath = pname.realpath(pname)
|
|
225
|
+
path, dir, base = rpath.to_s, rpath.dirname.to_s, rpath.basename.to_s
|
|
226
|
+
# puts " rpath = #{rpath} path = #{path} dir = #{dir} base = #{base}"
|
|
227
|
+
dok, fok = Dir.exist?(dir), File.exist?(path)
|
|
228
|
+
raise "No such dir #{dir.inspect} (file #{path})" unless dok
|
|
229
|
+
raise "No such file #{path.inspect} (file #{path})" unless fok
|
|
230
|
+
lines = File.readlines(path)
|
|
194
231
|
else
|
|
195
232
|
lines = api.body
|
|
196
233
|
end
|
|
@@ -416,6 +453,36 @@ puts ">> variables: pre=#{prefix.inspect} file=#{file.inspect} pwd=#{Dir.pwd}"
|
|
|
416
453
|
api.optional_blank_line
|
|
417
454
|
end
|
|
418
455
|
|
|
456
|
+
def table(args = nil, body = nil) # Same as xtable
|
|
457
|
+
title = api.data
|
|
458
|
+
delim = " :: "
|
|
459
|
+
api.out "<br>\n\n<center><table width=90% cellpadding=5>"
|
|
460
|
+
lines = api.body(true)
|
|
461
|
+
maxw = nil
|
|
462
|
+
processed = []
|
|
463
|
+
lines.each do |line|
|
|
464
|
+
line = api.format(line)
|
|
465
|
+
line.gsub!(/\n+/, "<br>\n")
|
|
466
|
+
processed << line
|
|
467
|
+
cells = line.split(delim)
|
|
468
|
+
wide = cells.map {|cell| cell.length }
|
|
469
|
+
maxw = [0] * cells.size
|
|
470
|
+
maxw = maxw.map.with_index {|x, i| [x, wide[i]].max }
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
sum = maxw.inject(0, :+)
|
|
474
|
+
maxw.map! {|x| (x/sum*100).floor }
|
|
475
|
+
|
|
476
|
+
processed.each do |line|
|
|
477
|
+
cells = line.split(delim)
|
|
478
|
+
html.wrap :tr do
|
|
479
|
+
cells.each {|cell| api.out " <td valign=top>#{cell}</td>" }
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
api.out "</table></center>"
|
|
483
|
+
api.optional_blank_line
|
|
484
|
+
end
|
|
485
|
+
|
|
419
486
|
def image(args = nil, body = nil)
|
|
420
487
|
name, wide, high = api.args
|
|
421
488
|
geom = ""
|
data/lib/livetext/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: livetext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.43
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hal Fulton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-05-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A smart text processor extensible in Ruby
|
|
14
14
|
email: rubyhacker@gmail.com
|