livetext 0.9.36 → 0.9.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/livetext/helpers.rb +1 -1
- data/lib/livetext/more.rb +2 -1
- data/lib/livetext/standard.rb +48 -48
- data/lib/livetext/version.rb +1 -1
- data/plugin/bookish.rb +35 -31
- 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: 784ac1767694b1d098d3e289082070ef3e3df0aab15766cf42105e854da31730
|
4
|
+
data.tar.gz: b6f62f1164873ec613b16067c53abc0e1b8906cacaeaae033bd5e862ca6b4bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 795730de451f27c2ffccf326fcc976e170ae884fef45d3bc732bb59826cc40bbff0e877d3ee3ed051fa3f20e0836ccede6668c42ba7a21ec1bf51910ebfc7a99
|
7
|
+
data.tar.gz: 1db7dfbb839a6787872df65d591b49fb36db69f9d3ddc86805d981f19266c98abcac4a8bbe8efebdf1137ec674201a3b3f4e0f09d849116acb56f390eefd8cbd
|
data/lib/livetext/helpers.rb
CHANGED
data/lib/livetext/more.rb
CHANGED
data/lib/livetext/standard.rb
CHANGED
@@ -44,23 +44,23 @@ module Livetext::Standard
|
|
44
44
|
# end
|
45
45
|
# end
|
46
46
|
|
47
|
-
def backtrace
|
47
|
+
def backtrace(args = nil, body = nil)
|
48
48
|
@backtrace = onoff(api.args.first)
|
49
49
|
api.optional_blank_line
|
50
50
|
end
|
51
51
|
|
52
|
-
def comment
|
52
|
+
def comment(args = nil, body = nil)
|
53
53
|
api.body
|
54
54
|
api.optional_blank_line
|
55
55
|
end
|
56
56
|
|
57
|
-
def shell
|
57
|
+
def shell(args = nil, body = nil)
|
58
58
|
cmd = api.data
|
59
59
|
system(cmd)
|
60
60
|
api.optional_blank_line
|
61
61
|
end
|
62
62
|
|
63
|
-
def func
|
63
|
+
def func(args = nil, body = nil)
|
64
64
|
funcname = api.args[0]
|
65
65
|
# check_disallowed(funcname) # should any be invalid?
|
66
66
|
funcname = funcname.gsub(/\./, "__")
|
@@ -74,21 +74,21 @@ module Livetext::Standard
|
|
74
74
|
return true
|
75
75
|
end
|
76
76
|
|
77
|
-
def h1; api.out
|
78
|
-
def h2; api.out
|
79
|
-
def h3; api.out
|
80
|
-
def h4; api.out
|
81
|
-
def h5; api.out
|
82
|
-
def h6; api.out
|
77
|
+
def h1(args = nil, body = nil); api.out html.tag(:h1, api.data); return true; end
|
78
|
+
def h2(args = nil, body = nil); api.out html.tag(:h2, api.data); return true; end
|
79
|
+
def h3(args = nil, body = nil); api.out html.tag(:h3, api.data); return true; end
|
80
|
+
def h4(args = nil, body = nil); api.out html.tag(:h4, api.data); return true; end
|
81
|
+
def h5(args = nil, body = nil); api.out html.tag(:h5, api.data); return true; end
|
82
|
+
def h6(args = nil, body = nil); api.out html.tag(:h6, api.data); return true; end
|
83
83
|
|
84
|
-
def list
|
84
|
+
def list(args = nil, body = nil)
|
85
85
|
html.wrap :ul do
|
86
|
-
api.body {|line| api.out
|
86
|
+
api.body {|line| api.out html.tag(:li, line) }
|
87
87
|
end
|
88
88
|
api.optional_blank_line
|
89
89
|
end
|
90
90
|
|
91
|
-
def list!
|
91
|
+
def list!(args = nil, body = nil)
|
92
92
|
html.wrap(:ul) do
|
93
93
|
lines = api.body.each # enumerator
|
94
94
|
loop do
|
@@ -101,41 +101,41 @@ module Livetext::Standard
|
|
101
101
|
api.optional_blank_line
|
102
102
|
end
|
103
103
|
|
104
|
-
def shell!
|
104
|
+
def shell!(args = nil, body = nil)
|
105
105
|
cmd = api.data
|
106
106
|
system(cmd)
|
107
107
|
api.optional_blank_line
|
108
108
|
end
|
109
109
|
|
110
|
-
def errout
|
110
|
+
def errout(args = nil, body = nil)
|
111
111
|
::STDERR.puts api.data
|
112
112
|
api.optional_blank_line
|
113
113
|
end
|
114
114
|
|
115
|
-
def ttyout
|
115
|
+
def ttyout(args = nil, body = nil)
|
116
116
|
TTY.puts api.data
|
117
117
|
api.optional_blank_line
|
118
118
|
end
|
119
119
|
|
120
|
-
def say(
|
121
|
-
data =
|
120
|
+
def say(args = nil, body = nil)
|
121
|
+
data = args || api.args.join(" ")
|
122
122
|
str = api.format(data)
|
123
123
|
TTY.puts "(say) #{str}"
|
124
124
|
api.optional_blank_line
|
125
125
|
end
|
126
126
|
|
127
|
-
def banner
|
127
|
+
def banner(args = nil, body = nil)
|
128
128
|
str = api.format(api.data)
|
129
129
|
num = str.length
|
130
130
|
decor = "-"*num + "\n"
|
131
131
|
puts decor + str + "\n" + decor
|
132
132
|
end
|
133
133
|
|
134
|
-
def quit
|
134
|
+
def quit(args = nil, body = nil)
|
135
135
|
@output.close
|
136
136
|
end
|
137
137
|
|
138
|
-
def cleanup
|
138
|
+
def cleanup(args = nil, body = nil)
|
139
139
|
api.args.each do |item|
|
140
140
|
cmd = ::File.directory?(item) ? "rm -f #{item}/*" : "rm #{item}"
|
141
141
|
system(cmd)
|
@@ -143,7 +143,7 @@ module Livetext::Standard
|
|
143
143
|
api.optional_blank_line
|
144
144
|
end
|
145
145
|
|
146
|
-
def dot_def
|
146
|
+
def dot_def(args = nil, body = nil)
|
147
147
|
name = api.args[0]
|
148
148
|
check_disallowed(name)
|
149
149
|
# Difficult to avoid eval here
|
@@ -154,7 +154,7 @@ module Livetext::Standard
|
|
154
154
|
api.optional_blank_line
|
155
155
|
end
|
156
156
|
|
157
|
-
def set
|
157
|
+
def set(args = nil, body = nil)
|
158
158
|
line = api.args.join(" ") # data.chomp
|
159
159
|
pairs = Livetext::ParseSet.new(line).parse
|
160
160
|
api.setvars(pairs)
|
@@ -163,7 +163,7 @@ module Livetext::Standard
|
|
163
163
|
|
164
164
|
# FIXME really these should be one method...
|
165
165
|
|
166
|
-
def variables! # cwd, not FileDir - weird, fix later
|
166
|
+
def variables!(args = nil, body = nil) # cwd, not FileDir - weird, fix later
|
167
167
|
prefix = api.args[0]
|
168
168
|
file = api.args[1]
|
169
169
|
prefix = nil if prefix == "-" # FIXME dumb hack
|
@@ -178,7 +178,7 @@ module Livetext::Standard
|
|
178
178
|
api.optional_blank_line
|
179
179
|
end
|
180
180
|
|
181
|
-
def variables
|
181
|
+
def variables(args = nil, body = nil)
|
182
182
|
prefix = api.args[0]
|
183
183
|
file = api.args[1]
|
184
184
|
prefix = nil if prefix == "-" # FIXME dumb hack
|
@@ -193,7 +193,7 @@ module Livetext::Standard
|
|
193
193
|
api.optional_blank_line
|
194
194
|
end
|
195
195
|
|
196
|
-
def heredoc
|
196
|
+
def heredoc(args = nil, body = nil)
|
197
197
|
var = api.args[0]
|
198
198
|
text = api.body.join("\n")
|
199
199
|
rhs = ""
|
@@ -207,7 +207,7 @@ module Livetext::Standard
|
|
207
207
|
api.optional_blank_line
|
208
208
|
end
|
209
209
|
|
210
|
-
def seek # like include, but search upward as needed
|
210
|
+
def seek(args = nil, body = nil) # like include, but search upward as needed
|
211
211
|
file = api.args.first
|
212
212
|
file = search_upward(file)
|
213
213
|
check_file_exists(file)
|
@@ -215,14 +215,14 @@ module Livetext::Standard
|
|
215
215
|
api.optional_blank_line
|
216
216
|
end
|
217
217
|
|
218
|
-
def dot_include # dot command
|
218
|
+
def dot_include(args = nil, body = nil) # dot command
|
219
219
|
file = api.expand_variables(api.args.first) # allows for variables
|
220
220
|
check_file_exists(file)
|
221
221
|
@parent.process_file(file)
|
222
222
|
api.optional_blank_line
|
223
223
|
end
|
224
224
|
|
225
|
-
def inherit
|
225
|
+
def inherit(args = nil, body = nil)
|
226
226
|
file = api.args.first
|
227
227
|
upper = "../#{file}"
|
228
228
|
got_upper, got_file = File.exist?(upper), File.exist?(file)
|
@@ -234,7 +234,7 @@ module Livetext::Standard
|
|
234
234
|
api.optional_blank_line
|
235
235
|
end
|
236
236
|
|
237
|
-
def mixin
|
237
|
+
def mixin(args = nil, body = nil)
|
238
238
|
name = api.args.first # Expect a module name
|
239
239
|
@mixins ||= []
|
240
240
|
return if @mixins.include?(name)
|
@@ -246,7 +246,7 @@ module Livetext::Standard
|
|
246
246
|
api.optional_blank_line
|
247
247
|
end
|
248
248
|
|
249
|
-
def import
|
249
|
+
def import(args = nil, body = nil)
|
250
250
|
name = api.args.first # Expect a module name
|
251
251
|
@imports ||= []
|
252
252
|
return if @imports.include?(name)
|
@@ -258,7 +258,7 @@ module Livetext::Standard
|
|
258
258
|
api.optional_blank_line
|
259
259
|
end
|
260
260
|
|
261
|
-
def copy
|
261
|
+
def copy(args = nil, body = nil)
|
262
262
|
file = api.args.first
|
263
263
|
ok = check_file_exists(file)
|
264
264
|
|
@@ -268,67 +268,67 @@ module Livetext::Standard
|
|
268
268
|
[ok, file]
|
269
269
|
end
|
270
270
|
|
271
|
-
def r
|
271
|
+
def r(args = nil, body = nil)
|
272
272
|
# FIXME api.data is broken
|
273
273
|
# api.out api.data # No processing at all
|
274
274
|
api.out api.args.join(" ")
|
275
275
|
api.optional_blank_line
|
276
276
|
end
|
277
277
|
|
278
|
-
def raw
|
278
|
+
def raw(args = nil, body = nil)
|
279
279
|
# No processing at all (terminate with __EOF__)
|
280
280
|
api.raw_body {|line| api.out line } # no formatting
|
281
281
|
api.optional_blank_line
|
282
282
|
end
|
283
283
|
|
284
|
-
def debug
|
284
|
+
def debug(args = nil, body = nil)
|
285
285
|
@debug = onoff(api.args.first)
|
286
286
|
api.optional_blank_line
|
287
287
|
end
|
288
288
|
|
289
|
-
def passthru
|
289
|
+
def passthru(args = nil, body = nil)
|
290
290
|
# FIXME - add check for args size? (helpers)
|
291
291
|
@nopass = ! onoff(api.args.first)
|
292
292
|
api.optional_blank_line
|
293
293
|
end
|
294
294
|
|
295
|
-
def nopass
|
295
|
+
def nopass(args = nil, body = nil)
|
296
296
|
@nopass = true
|
297
297
|
api.optional_blank_line
|
298
298
|
end
|
299
299
|
|
300
|
-
def para
|
300
|
+
def para(args = nil, body = nil)
|
301
301
|
# FIXME - add check for args size? (helpers)
|
302
302
|
@nopara = ! onoff(api.args.first)
|
303
303
|
api.optional_blank_line
|
304
304
|
end
|
305
305
|
|
306
|
-
def nopara
|
306
|
+
def nopara(args = nil, body = nil)
|
307
307
|
@nopara = true
|
308
308
|
api.optional_blank_line
|
309
309
|
end
|
310
310
|
|
311
|
-
def heading
|
311
|
+
def heading(args = nil, body = nil)
|
312
312
|
api.print "<center><font size=+1><b>"
|
313
313
|
api.print api.data
|
314
314
|
api.print "</b></font></center>"
|
315
315
|
api.optional_blank_line
|
316
316
|
end
|
317
317
|
|
318
|
-
def newpage
|
318
|
+
def newpage(args = nil, body = nil)
|
319
319
|
api.out '<p style="page-break-after:always;"></p>'
|
320
320
|
api.out "<p/>"
|
321
321
|
api.optional_blank_line
|
322
322
|
end
|
323
323
|
|
324
|
-
def mono
|
324
|
+
def mono(args = nil, body = nil)
|
325
325
|
html.wrap ":pre" do
|
326
326
|
api.body(true) {|line| api.out line }
|
327
327
|
end
|
328
328
|
api.optional_blank_line
|
329
329
|
end
|
330
330
|
|
331
|
-
def dlist
|
331
|
+
def dlist(args = nil, body = nil)
|
332
332
|
delim = api.args.first
|
333
333
|
html.wrap(:dl) do
|
334
334
|
api.body do |line|
|
@@ -341,14 +341,14 @@ module Livetext::Standard
|
|
341
341
|
api.optional_blank_line
|
342
342
|
end
|
343
343
|
|
344
|
-
def link
|
344
|
+
def link(args = nil, body = nil)
|
345
345
|
url = api.args.first
|
346
346
|
text = api.args[2..-1].join(" ")
|
347
347
|
api.out "<a style='text-decoration: none' href='#{url}'>#{text}</a>"
|
348
348
|
api.optional_blank_line
|
349
349
|
end
|
350
350
|
|
351
|
-
def xtable # Borrowed from bookish - FIXME
|
351
|
+
def xtable(args = nil, body = nil) # Borrowed from bookish - FIXME
|
352
352
|
title = api.data
|
353
353
|
delim = " :: "
|
354
354
|
api.out "<br><center><table width=90% cellpadding=5>"
|
@@ -378,7 +378,7 @@ module Livetext::Standard
|
|
378
378
|
api.optional_blank_line
|
379
379
|
end
|
380
380
|
|
381
|
-
def image
|
381
|
+
def image(args = nil, body = nil)
|
382
382
|
name, wide, high = api.args
|
383
383
|
geom = ""
|
384
384
|
geom = "width=#{wide} height=#{high}" if wide || high
|
@@ -386,7 +386,7 @@ module Livetext::Standard
|
|
386
386
|
api.optional_blank_line
|
387
387
|
end
|
388
388
|
|
389
|
-
def br
|
389
|
+
def br(args = nil, body = nil)
|
390
390
|
num = api.args.first || "1"
|
391
391
|
str = ""
|
392
392
|
num.to_i.times { str << "<br>" }
|
@@ -394,7 +394,7 @@ module Livetext::Standard
|
|
394
394
|
api.optional_blank_line
|
395
395
|
end
|
396
396
|
|
397
|
-
def reflection # strictly experimental!
|
397
|
+
def reflection(args = nil, body = nil) # strictly experimental!
|
398
398
|
list = self.methods
|
399
399
|
obj = Object.instance_methods
|
400
400
|
diff = (list - obj).sort
|
data/lib/livetext/version.rb
CHANGED
data/plugin/bookish.rb
CHANGED
@@ -15,9 +15,12 @@ end
|
|
15
15
|
|
16
16
|
# These are duplicated. Remove safely
|
17
17
|
|
18
|
-
def h1; api.out
|
19
|
-
def h2; api.out
|
20
|
-
def h3; api.out
|
18
|
+
def h1(args = nil, body = nil); api.out html.tag(:h1, api.data); return true; end
|
19
|
+
def h2(args = nil, body = nil); api.out html.tag(:h2, api.data); return true; end
|
20
|
+
def h3(args = nil, body = nil); api.out html.tag(:h3, api.data); return true; end
|
21
|
+
def h4(args = nil, body = nil); api.out html.tag(:h4, api.data); return true; end
|
22
|
+
def h5(args = nil, body = nil); api.out html.tag(:h5, api.data); return true; end
|
23
|
+
def h6(args = nil, body = nil); api.out html.tag(:h6, api.data); return true; end
|
21
24
|
|
22
25
|
def alpha_columns(args = nil, body = nil)
|
23
26
|
n = api.args.first.to_i # FIXME: what if it's missing?
|
@@ -71,7 +74,7 @@ def figure(args = nil, body = nil)
|
|
71
74
|
api.optional_blank_line
|
72
75
|
end
|
73
76
|
|
74
|
-
def
|
77
|
+
def xchapterN(args = nil, body = nil)
|
75
78
|
@chapter = api.args.first.to_i
|
76
79
|
@sec = @sec2 = 0
|
77
80
|
title = api.data.split(" ",2)[1]
|
@@ -81,13 +84,12 @@ def chapter(args = nil, body = nil)
|
|
81
84
|
api.out "<title>#{@chapter}. #{title}</title>"
|
82
85
|
api.out <<-HTML
|
83
86
|
<h2>Chapter #{@chapter}</h2>
|
84
|
-
<h1>#{title}</h1
|
85
|
-
|
87
|
+
<h1>#{title}</h1>\n
|
86
88
|
HTML
|
87
89
|
api.optional_blank_line
|
88
90
|
end
|
89
91
|
|
90
|
-
def
|
92
|
+
def chapter(args = nil, body = nil)
|
91
93
|
@chapter += 1
|
92
94
|
@sec = @sec2 = 0
|
93
95
|
title = api.data # .split(" ",2)[1]
|
@@ -98,8 +100,7 @@ def chapterN(args = nil, body = nil)
|
|
98
100
|
api.out "<title>#{@chapter}. #{title}</title>"
|
99
101
|
api.out <<-HTML
|
100
102
|
<h2>Chapter #{@chapter}</h2>
|
101
|
-
<h1>#{title}</h1
|
102
|
-
|
103
|
+
<h1>#{title}</h1>\n
|
103
104
|
HTML
|
104
105
|
api.optional_blank_line
|
105
106
|
end
|
@@ -115,8 +116,8 @@ def sec(args = nil, body = nil)
|
|
115
116
|
api.out "<h3>#@section #{title}</h3>\n"
|
116
117
|
api.optional_blank_line
|
117
118
|
rescue => err
|
118
|
-
api.tty "#{err}\n#{err.backtrace}"
|
119
|
-
::STDERR.puts "#{err}\n#{err.backtrace}"
|
119
|
+
api.tty "#{err}\n#{err.backtrace.join("\n")}"
|
120
|
+
::STDERR.puts "#{err}\n#{err.backtrace.join("\n")}"
|
120
121
|
exit
|
121
122
|
end
|
122
123
|
|
@@ -296,22 +297,22 @@ rescue => err
|
|
296
297
|
end
|
297
298
|
|
298
299
|
def init_bookish
|
300
|
+
@_file_num = 0
|
299
301
|
@toc_file = "toc.tmp"
|
300
302
|
@toc = ::File.new(@toc_file, "w")
|
301
303
|
@chapter = -1
|
302
304
|
end
|
303
305
|
|
304
|
-
|
306
|
+
###########
|
305
307
|
|
306
|
-
|
307
|
-
def outdir
|
308
|
+
def outdir(args = nil, body = nil)
|
308
309
|
@_outdir = api.args.first
|
309
310
|
# @output = STDOUT
|
310
311
|
@output = nil
|
311
312
|
api.optional_blank_line
|
312
313
|
end
|
313
314
|
|
314
|
-
def outdir! # FIXME ?
|
315
|
+
def outdir!(args = nil, body = nil) # FIXME ?
|
315
316
|
@_outdir = api.args.first
|
316
317
|
raise "No output directory specified" if @_outdir.nil?
|
317
318
|
raise "No output directory specified" if @_outdir.empty?
|
@@ -327,12 +328,12 @@ def _append(name)
|
|
327
328
|
end
|
328
329
|
|
329
330
|
|
330
|
-
def append
|
331
|
+
def append(args = nil, body = nil)
|
331
332
|
file = api.args[0]
|
332
333
|
_append(file)
|
333
334
|
end
|
334
335
|
|
335
|
-
def close_output
|
336
|
+
def close_output(args = nil, body = nil)
|
336
337
|
return if @output == STDOUT
|
337
338
|
@_outdir ||= "."
|
338
339
|
@output.puts "<meta charset='UTF-8'>\n\n"
|
@@ -343,16 +344,19 @@ def close_output
|
|
343
344
|
end
|
344
345
|
|
345
346
|
def _prep_next_output(args)
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
347
|
+
*title = args # _next_output(tag, num)
|
348
|
+
title = title.join(" ")
|
349
|
+
slug = _slug(title)
|
350
|
+
api.tty "title = #{title.inspect}"
|
351
|
+
@_file_num += 1
|
352
|
+
fname = "#{'%03d' % @_file_num}-#{slug}.html"
|
353
|
+
api.tty "slug, fnum, fname= #{[slug, @_file_num, fname].inspect}"
|
354
|
+
fname
|
355
|
+
end
|
356
|
+
|
357
|
+
def next_output(args = nil, body = nil)
|
358
|
+
args ||= api.args
|
359
|
+
fname = _prep_next_output(args)
|
356
360
|
@_outdir ||= "."
|
357
361
|
unless @output.nil?
|
358
362
|
@output.puts "<meta charset='UTF-8'>\n\n"
|
@@ -360,12 +364,12 @@ def next_output
|
|
360
364
|
@parent.body = ""
|
361
365
|
@output.close unless @output == STDOUT
|
362
366
|
end
|
363
|
-
fname = @_outdir + "/" +
|
367
|
+
fname = @_outdir + "/" + fname
|
364
368
|
@output = File.open(fname, "w")
|
365
369
|
api.optional_blank_line
|
366
370
|
end
|
367
371
|
|
368
|
-
def output
|
372
|
+
def output(args = nil, body = nil)
|
369
373
|
name = api.args.first
|
370
374
|
_debug "Redirecting output to: #{name}"
|
371
375
|
# _output(name)
|
@@ -378,7 +382,7 @@ def output
|
|
378
382
|
@output = File.open(fname, "w") #; STDERR.puts "---- @out = #{@output.inspect}"
|
379
383
|
end
|
380
384
|
|
381
|
-
def columns
|
385
|
+
def columns(args = nil, body = nil)
|
382
386
|
api.out "<table border=1><tr><td valign=top><br>\n"
|
383
387
|
api.body.to_a.each do |line|
|
384
388
|
if line.start_with?("##col")
|
@@ -392,7 +396,7 @@ def columns
|
|
392
396
|
api.out "<br>\n</td></tr></table>"
|
393
397
|
end
|
394
398
|
|
395
|
-
def quote
|
399
|
+
def quote(args = nil, body = nil)
|
396
400
|
api.out "<blockquote>"
|
397
401
|
lines = api.body.to_a
|
398
402
|
# STDERR.puts "-----------------------------------------------------"
|
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.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A smart text processor extensible in Ruby
|
14
14
|
email: rubyhacker@gmail.com
|