livetext 0.9.41 → 0.9.42
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/bin/livetext +23 -0
- data/lib/livetext/more.rb +0 -2
- data/lib/livetext/standard.rb +8 -0
- data/lib/livetext/version.rb +1 -1
- data/test/snapshots/table_with_heredocs/expected-output.txt +3 -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: 3cef25ba4a47577159b300d63d723939aef6e5bef6c083685d8f6539e988601e
|
4
|
+
data.tar.gz: a20a3a5e09c47639180428833a62c855a0a13d26ec317b49a3e400b9f0b4a64c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ddc892156911f77e9bd4b3878e77ddfba0d739b03c5df0fbeefb1b22562c03f173ffdc36fceff940273557a27c12cec0a4aea3a35a5470efdfd5ec360f0261
|
7
|
+
data.tar.gz: f222133e7b2e784e15b43241e711e29bad362c10f41857e1e72883aac95d523580127a50a146a5b539e266eea98067e094b6dc3b1490e6b8a2d1b88c1a813b08
|
data/bin/livetext
CHANGED
@@ -5,6 +5,25 @@ require 'rubygems'
|
|
5
5
|
require_relative '../lib/livetext'
|
6
6
|
|
7
7
|
def usage
|
8
|
+
STDERR.puts <<~EOF
|
9
|
+
Usage:
|
10
|
+
livetext [options] [filename]
|
11
|
+
|
12
|
+
Options:
|
13
|
+
-v, --version Print version information
|
14
|
+
-t, --test Run all tests
|
15
|
+
-p, --path Print the path of the installed gem
|
16
|
+
-b, --backtrace Enable backtrace information
|
17
|
+
-m name, --mixin name Load the specified mixin before processing
|
18
|
+
-s, --stdin Read from standard input
|
19
|
+
-h, --help Print this help information
|
20
|
+
-i name, --install name Install the specified plugin
|
21
|
+
|
22
|
+
EOF
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
def old_usage
|
8
27
|
STDERR.puts <<~EOF
|
9
28
|
Usage:
|
10
29
|
livetext filename
|
@@ -22,6 +41,10 @@ def usage
|
|
22
41
|
livetext -p
|
23
42
|
livetext --path
|
24
43
|
|
44
|
+
Load a mixin:
|
45
|
+
livetext -m name
|
46
|
+
livetext --mixin name
|
47
|
+
|
25
48
|
Run tests:
|
26
49
|
livetext -t
|
27
50
|
livetext --test
|
data/lib/livetext/more.rb
CHANGED
@@ -101,12 +101,10 @@ class Livetext
|
|
101
101
|
obj = self.new
|
102
102
|
mix = Array(mix)
|
103
103
|
call = Array(call)
|
104
|
-
# STDERR.puts "#{__method__}: obj meth = #{obj.methods.sort.inspect}"
|
105
104
|
mix.each do |lib|
|
106
105
|
obj.invoke_dotcmd(:mixin, lib.dup)
|
107
106
|
end
|
108
107
|
call.each {|cmd| obj.main.send(cmd[1..-1]) } # ignores leading dot, no param
|
109
|
-
# vars.each_pair {|var, val| obj.setvar(var, val.to_s) }
|
110
108
|
obj.api.setvars(vars)
|
111
109
|
obj
|
112
110
|
end
|
data/lib/livetext/standard.rb
CHANGED
@@ -182,7 +182,12 @@ module Livetext::Standard
|
|
182
182
|
def variables(args = nil, body = nil)
|
183
183
|
prefix = api.args[0]
|
184
184
|
file = api.args[1]
|
185
|
+
puts ">> variables: pre=#{prefix.inspect} file=#{file.inspect} pwd=#{Dir.pwd}"
|
185
186
|
prefix = nil if prefix == "-" # FIXME dumb hack
|
187
|
+
here = File.dirname(file)
|
188
|
+
dok, fok = Dir.exist?(here), File.exist?(file)
|
189
|
+
raise "No such dir #{here.inspect} (file #{file})" unless dok
|
190
|
+
raise "No such file #{file.inspect} (file #{file})" unless fok
|
186
191
|
if file
|
187
192
|
here = ::Livetext::Vars[:FileDir] + "/"
|
188
193
|
lines = File.readlines(here + file)
|
@@ -192,6 +197,9 @@ module Livetext::Standard
|
|
192
197
|
pairs = Livetext::ParseGeneral.parse_vars(lines, prefix: nil)
|
193
198
|
api.setvars(pairs)
|
194
199
|
api.optional_blank_line
|
200
|
+
rescue => e
|
201
|
+
puts e
|
202
|
+
puts $!
|
195
203
|
end
|
196
204
|
|
197
205
|
def heredoc(args = nil, body = nil)
|
data/lib/livetext/version.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Testing heredocs (used in a table)
|
2
2
|
<p>
|
3
3
|
|
4
|
-
<br
|
4
|
+
<br>
|
5
|
+
|
6
|
+
<center><table width=90% cellpadding=5>
|
5
7
|
<tr>
|
6
8
|
<td valign=top>This is <br>only <br>a test.<br></td>
|
7
9
|
<td valign=top>This is <br>just <br>some <br>random text.<br></td>
|
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.42
|
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-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A smart text processor extensible in Ruby
|
14
14
|
email: rubyhacker@gmail.com
|