livetext 0.9.14 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +2 -2
  3. data/imports/bookish.rb +288 -0
  4. data/imports/calibre.rb +28 -0
  5. data/imports/livemagick.rb +133 -0
  6. data/imports/markdown.rb +44 -0
  7. data/imports/markdown_importable.rb +46 -0
  8. data/imports/pyggish.rb +204 -0
  9. data/imports/tutorial.rb +95 -0
  10. data/lib/cmdargs.rb +93 -0
  11. data/lib/formatline.rb +56 -83
  12. data/lib/handler/icanhaz.rb +35 -0
  13. data/lib/handler.rb +1 -0
  14. data/lib/helpers.rb +173 -4
  15. data/lib/livetext.rb +16 -141
  16. data/lib/parser/file.rb +8 -0
  17. data/lib/parser/import.rb +1 -3
  18. data/lib/parser/mixin.rb +22 -24
  19. data/lib/parser/set.rb +35 -26
  20. data/lib/parser/string.rb +19 -4
  21. data/lib/processor.rb +1 -4
  22. data/lib/standard.rb +68 -97
  23. data/lib/userapi.rb +1 -0
  24. data/livetext.gemspec +2 -1
  25. data/plugin/bookish.rb +26 -22
  26. data/plugin/calibre.rb +1 -1
  27. data/plugin/livemagick.rb +10 -10
  28. data/plugin/markdown.rb +13 -11
  29. data/plugin/pyggish.rb +94 -84
  30. data/plugin/tutorial.rb +10 -5
  31. data/test/all.rb +0 -1
  32. data/test/snapshots/OMIT.txt +9 -8
  33. data/test/snapshots/clusion.txt +84 -0
  34. data/test/snapshots/error_inc_line_num/match-error.txt +1 -1
  35. data/test/snapshots/error_invalid_name/match-error.txt +1 -1
  36. data/test/snapshots/error_line_num/match-error.txt +1 -1
  37. data/test/snapshots/error_mismatched_end/match-error.txt +1 -1
  38. data/test/snapshots/error_missing_end/match-error.txt +1 -1
  39. data/test/snapshots/error_no_such_copy/match-error.txt +1 -1
  40. data/test/snapshots/error_no_such_copy/source.lt3 +0 -1
  41. data/test/snapshots/error_no_such_inc/match-error.txt +1 -1
  42. data/test/snapshots/icanhaz/expected-output.txt +5 -0
  43. data/test/snapshots/icanhaz/match-error.txt +1 -0
  44. data/test/snapshots/icanhaz/simple_import.rb +5 -0
  45. data/test/snapshots/icanhaz/source.lt3 +10 -0
  46. data/test/snapshots/icanhaz2/expected-error.txt +0 -0
  47. data/test/snapshots/icanhaz2/expected-output.txt +6 -0
  48. data/test/snapshots/icanhaz2/simple_canhaz.rb +5 -0
  49. data/test/snapshots/icanhaz2/source.lt3 +6 -0
  50. data/test/snapshots/simple_import/expected-error.txt +0 -0
  51. data/test/snapshots/simple_import/expected-output.txt +7 -0
  52. data/test/snapshots/simple_import/simple_import.rb +5 -0
  53. data/test/snapshots/simple_import/source.lt3 +7 -0
  54. data/test/snapshots/simple_include/source.lt3 +0 -1
  55. data/test/snapshots.rb +85 -37
  56. data/test/unit/all.rb +1 -0
  57. data/test/unit/formatline.rb +650 -0
  58. data/test/unit/parser/importable.rb +1 -1
  59. data/test/unit/parser/mixin.rb +1 -1
  60. data/test/unit/parser/set.rb +19 -12
  61. data/test/unit/parser/string.rb +14 -14
  62. metadata +27 -5
  63. data/test/formatting-tests.rb +0 -35
  64. data/test/formatting.rb +0 -103
  65. data/test/snapshots/formatting-tests.txt +0 -124
data/lib/parser/string.rb CHANGED
@@ -5,14 +5,13 @@ class StringParser
5
5
  def initialize(line)
6
6
  raise NilValue if line.nil?
7
7
  raise ExpectedString unless String === line
8
- # raise NullString if line.empty?
9
8
  @line = line
10
9
  @len = @line.length
11
10
  @eos = @len == 0 ? true : false
12
11
  @i = 0
13
12
  end
14
13
 
15
- def next
14
+ def grab
16
15
  return nil if @eos
17
16
  char = @line[@i]
18
17
  @i += 1
@@ -20,6 +19,19 @@ class StringParser
20
19
  char
21
20
  end
22
21
 
22
+ def ungrab
23
+ @i -= 1 # FIXME what about eos...?
24
+ end
25
+
26
+ def next!
27
+ @line[@i + 1]
28
+ end
29
+
30
+ def prev
31
+ return nil if @i <= 0
32
+ @line[@i-1]
33
+ end
34
+
23
35
  def last?
24
36
  @i > @len - 1
25
37
  end
@@ -35,11 +47,14 @@ class StringParser
35
47
  end
36
48
 
37
49
  def skip_spaces
50
+ char = nil
38
51
  loop do
39
- break if peek != " "
52
+ char = peek
40
53
  break if eos?
41
- self.next
54
+ break if char != " "
55
+ grab
42
56
  end
57
+ char
43
58
  end
44
59
 
45
60
  end
data/lib/processor.rb CHANGED
@@ -45,7 +45,7 @@ class Livetext
45
45
  raise GenericError.new("Error: #{err}") if raise_error
46
46
  end
47
47
 
48
- def _disallowed?(name)
48
+ def disallowed?(name)
49
49
  Disallowed.include?(name.to_sym)
50
50
  end
51
51
 
@@ -71,8 +71,5 @@ class Livetext
71
71
  @sources.pop
72
72
  nil
73
73
  end
74
-
75
-
76
74
  end
77
-
78
75
  end
data/lib/standard.rb CHANGED
@@ -5,8 +5,8 @@ require_relative 'html'
5
5
  require_relative 'helpers'
6
6
 
7
7
  make_exception(:ExpectedOnOff, "Error: expected 'on' or 'off'")
8
- make_exception(:DisallowedName, "Error: name %1 is invalid")
9
- make_exception(:FileNotFound, "Error: file %1 not found")
8
+ make_exception(:DisallowedName, "Error: name '%1' is invalid")
9
+ make_exception(:FileNotFound, "Error: file '%1' not found")
10
10
 
11
11
 
12
12
  # Module Standard comprises most of the standard or "common" methods.
@@ -30,7 +30,8 @@ module Livetext::Standard
30
30
  @_mixins = []
31
31
  end
32
32
 
33
- def bits # dumb name - bold, italic, teletype, striketrough
33
+ # dumb name - bold, italic, teletype, striketrough
34
+ def bits(args = nil, body = nil)
34
35
  b0, b1, i0, i1, t0, t1, s0, s1 = *@_args
35
36
  SimpleFormats[:b] = [b0, b1]
36
37
  SimpleFormats[:i] = [i0, i1]
@@ -38,23 +39,23 @@ module Livetext::Standard
38
39
  SimpleFormats[:s] = [s0, s1]
39
40
  end
40
41
 
41
- def backtrace
42
+ def backtrace(args = nil, body = nil)
42
43
  @backtrace = onoff(@_args.first)
43
44
  _optional_blank_line
44
45
  end
45
46
 
46
- def comment
47
+ def comment(args = nil, body = nil)
47
48
  _body
48
49
  _optional_blank_line
49
50
  end
50
51
 
51
- def shell
52
+ def shell(args = nil, body = nil)
52
53
  cmd = @_data.chomp
53
54
  system(cmd)
54
55
  _optional_blank_line
55
56
  end
56
57
 
57
- def func
58
+ def func(args = nil, body = nil)
58
59
  funcname = @_args[0]
59
60
  check_disallowed(funcname)
60
61
  func_def = <<~EOS
@@ -63,25 +64,24 @@ module Livetext::Standard
63
64
  end
64
65
  EOS
65
66
  _optional_blank_line
66
-
67
67
  Livetext::Functions.class_eval func_def
68
68
  end
69
69
 
70
- def h1; _out wrapped(@_data, :h1); end
71
- def h2; _out wrapped(@_data, :h2); end
72
- def h3; _out wrapped(@_data, :h3); end
73
- def h4; _out wrapped(@_data, :h4); end
74
- def h5; _out wrapped(@_data, :h5); end
75
- def h6; _out wrapped(@_data, :h6); end
70
+ def h1(args = nil, body = nil); _out wrapped(@_data, :h1); end
71
+ def h2(args = nil, body = nil); _out wrapped(@_data, :h2); end
72
+ def h3(args = nil, body = nil); _out wrapped(@_data, :h3); end
73
+ def h4(args = nil, body = nil); _out wrapped(@_data, :h4); end
74
+ def h5(args = nil, body = nil); _out wrapped(@_data, :h5); end
75
+ def h6(args = nil, body = nil); _out wrapped(@_data, :h6); end
76
76
 
77
- def list
77
+ def list(args = nil, body = nil)
78
78
  wrap :ul do
79
79
  _body {|line| _out wrapped(line, :li) }
80
80
  end
81
81
  _optional_blank_line
82
82
  end
83
83
 
84
- def list!
84
+ def list!(args = nil, body = nil)
85
85
  wrap(:ul) do
86
86
  lines = _body.each # enumerator
87
87
  loop do
@@ -94,49 +94,49 @@ module Livetext::Standard
94
94
  _optional_blank_line
95
95
  end
96
96
 
97
- def shell!
97
+ def shell!(args = nil, body = nil)
98
98
  cmd = @_data.chomp
99
99
  system(cmd)
100
100
  _optional_blank_line
101
101
  end
102
102
 
103
- def errout
103
+ def errout(args = nil, body = nil)
104
104
  STDERR.puts @_data.chomp
105
105
  _optional_blank_line
106
106
  end
107
107
 
108
- def ttyout
108
+ def ttyout(args = nil, body = nil)
109
109
  TTY.puts @_data.chomp
110
110
  _optional_blank_line
111
111
  end
112
112
 
113
- def say
113
+ def say(args = nil, body = nil)
114
114
  str = _format(@_data.chomp)
115
115
  TTY.puts str
116
116
  _optional_blank_line
117
117
  end
118
118
 
119
- def banner
119
+ def banner(args = nil, body = nil)
120
120
  str = _format(@_data.chomp)
121
- num = str.length - 1
121
+ num = str.length
122
122
  decor = "-"*num + "\n"
123
123
  puts decor + str + "\n" + decor
124
124
  end
125
125
 
126
- def quit
126
+ def quit(args = nil, body = nil)
127
127
  puts @body
128
128
  @body = ""
129
129
  @output.close
130
130
  end
131
131
 
132
- def cleanup
132
+ def cleanup(args = nil, body = nil)
133
133
  @_args.each do |item|
134
134
  cmd = ::File.directory?(item) ? "rm -f #{item}/*" : "rm #{item}"
135
135
  system(cmd)
136
136
  end
137
137
  end
138
138
 
139
- def _def
139
+ def dot_def(args = nil, body = nil)
140
140
  name = @_args[0]
141
141
  str = "def #{name}\n"
142
142
  check_disallowed(name)
@@ -144,11 +144,9 @@ module Livetext::Standard
144
144
  str << _body(true).join("\n")
145
145
  str << "\nend\n"
146
146
  eval str
147
- # rescue => err
148
- # _error!(err)
149
147
  end
150
148
 
151
- def set
149
+ def set(args = nil, body = nil)
152
150
  line = _data.chomp
153
151
  pairs = Livetext::ParseSet.new(line).parse
154
152
  set_variables(pairs)
@@ -156,7 +154,7 @@ module Livetext::Standard
156
154
 
157
155
  # FIXME really these should be one method...
158
156
 
159
- def variables! # cwd, not FileDir - weird, fix later
157
+ def variables!(args = nil, body = nil) # cwd, not FileDir - weird, fix later
160
158
  prefix = _args[0]
161
159
  file = _args[1]
162
160
  prefix = nil if prefix == "-" # FIXME dumb hack
@@ -170,7 +168,7 @@ module Livetext::Standard
170
168
  set_variables(pairs)
171
169
  end
172
170
 
173
- def variables
171
+ def variables(args = nil, body = nil)
174
172
  prefix = _args[0]
175
173
  file = _args[1]
176
174
  prefix = nil if prefix == "-" # FIXME dumb hack
@@ -184,7 +182,7 @@ module Livetext::Standard
184
182
  set_variables(pairs)
185
183
  end
186
184
 
187
- def heredoc
185
+ def heredoc(args = nil, body = nil)
188
186
  var = @_args[0]
189
187
  text = _body.join("\n")
190
188
  rhs = ""
@@ -194,52 +192,26 @@ module Livetext::Standard
194
192
  end
195
193
  indent = @parent.indentation.last
196
194
  indented = " " * indent
197
- @parent._setvar(var, rhs.chomp)
195
+ @parent.setvar(var, rhs.chomp)
198
196
  _optional_blank_line
199
197
  end
200
198
 
201
- def _seek(file)
202
- value = nil
203
- return file if File.exist?(file)
204
-
205
- count = 1
206
- loop do
207
- front = "../" * count
208
- count += 1
209
- here = Pathname.new(front).expand_path.dirname.to_s
210
- break if here == "/"
211
- path = front + file
212
- value = path if File.exist?(path)
213
- break if value
214
- end
215
- STDERR.puts "Cannot find #{file.inspect} from #{Dir.pwd}" unless value
216
- return value
217
- rescue
218
- STDERR.puts "Can't find #{file.inspect} from #{Dir.pwd}"
219
- return nil
220
- end
221
-
222
- def seek # like include, but search upward as needed
199
+ def seek(args = nil, body = nil) # like include, but search upward as needed
223
200
  file = @_args.first
224
- file = _seek(file)
201
+ file = search_upward(file)
225
202
  check_file_exists(file)
226
203
  @parent.process_file(file)
227
204
  _optional_blank_line
228
205
  end
229
206
 
230
- def _include # dot command
207
+ def dot_include(args = nil, body = nil) # dot command
231
208
  file = _format(@_args.first) # allows for variables
232
209
  check_file_exists(file)
233
210
  @parent.process_file(file)
234
211
  _optional_blank_line
235
212
  end
236
213
 
237
- def _include_file(file)
238
- @_args = [file]
239
- _include
240
- end
241
-
242
- def inherit
214
+ def inherit(args = nil, body = nil)
243
215
  file = @_args.first
244
216
  upper = "../#{file}"
245
217
  got_upper, got_file = File.exist?(upper), File.exist?(file)
@@ -251,95 +223,94 @@ module Livetext::Standard
251
223
  _optional_blank_line
252
224
  end
253
225
 
254
- def mixin
226
+ def mixin(args = nil, body = nil)
255
227
  name = @_args.first # Expect a module name
256
228
  return if @_mixins.include?(name)
257
229
  @_mixins << name
258
- parse = Livetext::ParseMixin.new # (name) # FIXME??
259
- file = parse.find_mixin(name)
260
- parse.use_mixin(name, file)
230
+ mod = Livetext::ParseMixin.get_module(name) # FIXME??
231
+ self.extend(mod)
232
+ init = "init_#{name}"
233
+ self.send(init) if self.respond_to? init
261
234
  _optional_blank_line
262
235
  end
263
236
 
264
- def import
237
+ def icanhaz(args = nil, body = nil)
265
238
  name = @_args.first # Expect a module name
266
239
  return if @_mixins.include?(name)
267
240
  @_mixins << name
268
- parse = Livetext::ParseImport.new(name)
241
+ mod = Livetext::Handler::ICanHaz.get_module(name) # FIXME??
242
+ self.extend(mod)
243
+ init = "init_#{name}"
244
+ self.send(init) if self.respond_to? init
245
+ _optional_blank_line
246
+ end
247
+
248
+ def import(args = nil, body = nil)
249
+ name = @_args.first # Expect a module name
250
+ return if @_mixins.include?(name)
251
+ @_mixins << name
252
+ mod = Livetext::ParseImport.get_module(name)
269
253
  parse.use_import(name)
270
254
  _optional_blank_line
271
255
  end
272
256
 
273
- def copy
257
+ def copy(args = nil, body = nil)
274
258
  file = @_args.first
275
259
  check_file_exists(file)
276
260
  _out grab_file(file)
277
261
  _optional_blank_line
278
262
  end
279
263
 
280
- def r
264
+ def r(args = nil, body = nil)
281
265
  _out @_data.chomp # No processing at all
282
266
  end
283
267
 
284
- def raw
268
+ def raw(args = nil, body = nil)
285
269
  # No processing at all (terminate with __EOF__)
286
270
  _raw_body {|line| _out line } # no formatting
287
271
  end
288
272
 
289
- def debug
273
+ def debug(args = nil, body = nil)
290
274
  self._debug = onoff(@_args.first)
291
275
  end
292
276
 
293
- def passthru
277
+ def passthru(args = nil, body = nil)
294
278
  # FIXME - add check for args size? (helpers)
295
279
  @_nopass = ! onoff(_args.first)
296
280
  end
297
281
 
298
- def nopass
282
+ def nopass(args = nil, body = nil)
299
283
  @_nopass = true
300
284
  end
301
285
 
302
- def para
286
+ def para(args = nil, body = nil)
303
287
  # FIXME - add check for args size? (helpers)
304
288
  @_nopara = ! onoff(_args.first)
305
289
  end
306
290
 
307
- def onoff(arg) # helper
308
- arg ||= "on"
309
- raise ExpectedOnOff unless String === arg
310
- case arg.downcase
311
- when "on"
312
- return true
313
- when "off"
314
- return false
315
- else
316
- raise ExpectedOnOff
317
- end
318
- end
319
-
320
- def nopara
291
+ def nopara(args = nil, body = nil)
321
292
  @_nopara = true
322
293
  end
323
294
 
324
- def heading
295
+ def heading(args = nil, body = nil)
325
296
  _print "<center><font size=+1><b>"
326
297
  _print @_data.chomp
327
298
  _print "</b></font></center>"
328
299
  end
329
300
 
330
- def newpage
301
+ def newpage(args = nil, body = nil)
331
302
  _out '<p style="page-break-after:always;"></p>'
332
303
  _out "<p/>"
333
304
  end
334
305
 
335
- def mono
306
+ def mono(args = nil, body = nil)
336
307
  wrap ":pre" do
337
308
  _body(true) {|line| _out line }
338
309
  end
339
310
  _optional_blank_line
340
311
  end
341
312
 
342
- def dlist
313
+ def dlist(args = nil, body = nil)
343
314
  delim = _args.first
344
315
  wrap(:dl) do
345
316
  _body do |line|
@@ -351,13 +322,13 @@ module Livetext::Standard
351
322
  end
352
323
  end
353
324
 
354
- def link
325
+ def link(args = nil, body = nil)
355
326
  url = _args.first
356
327
  text = _args[2..-1].join(" ")
357
328
  _out "<a style='text-decoration: none' href='#{url}'>#{text}</a>"
358
329
  end
359
330
 
360
- def xtable # Borrowed from bookish - FIXME
331
+ def xtable(args = nil, body = nil) # Borrowed from bookish - FIXME
361
332
  title = @_data.chomp
362
333
  delim = " :: "
363
334
  _out "<br><center><table width=90% cellpadding=5>"
@@ -384,12 +355,12 @@ module Livetext::Standard
384
355
  _out "</table></center>"
385
356
  end
386
357
 
387
- def image
358
+ def image(args = nil, body = nil)
388
359
  name = @_args[0]
389
360
  _out "<img src='#{name}'></img>"
390
361
  end
391
362
 
392
- def br
363
+ def br(args = nil, body = nil)
393
364
  num = _args.first || "1"
394
365
  out = ""
395
366
  num.to_i.times { out << "<br>" }
data/lib/userapi.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative 'formatline'
4
4
 
5
5
  # UserAPI deals mostly with user-level methods.
6
+
6
7
  module Livetext::UserAPI
7
8
 
8
9
  def setvar(var, val)
data/livetext.gemspec CHANGED
@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
15
15
  s.executables << "livetext"
16
16
 
17
17
  # Files...
18
- main = Find.find("bin").to_a + Find.find("lib").to_a + Find.find("plugin").to_a
18
+ main = Find.find("bin").to_a + Find.find("lib").to_a +
19
+ Find.find("plugin").to_a + Find.find("imports").to_a
19
20
  misc = %w[./README.lt3 ./README.md livetext.gemspec]
20
21
  test = Find.find("test").to_a
21
22
 
data/plugin/bookish.rb CHANGED
@@ -1,4 +1,4 @@
1
- def hardbreaks
1
+ def hardbreaks(args = nil, body = nil)
2
2
  @hard = false
3
3
  @hard = true unless @_args.first == "off"
4
4
  end
@@ -7,15 +7,17 @@ def hardbreaks?
7
7
  @hard
8
8
  end
9
9
 
10
- def credit
10
+ def credit(args = nil, body = nil)
11
11
  # really just a place marker in source
12
12
  end
13
13
 
14
+ # These are duplicated. Remove safely
15
+
14
16
  def h1; _out "<h1>#{@_data}</h1>"; end
15
17
  def h2; _out "<h2>#{@_data}</h2>"; end
16
18
  def h3; _out "<h3>#{@_data}</h3>"; end
17
19
 
18
- def alpha_columns
20
+ def alpha_columns(args = nil, body = nil)
19
21
  n = @_args.first.to_i # FIXME: what if missing?
20
22
  words = []
21
23
  _body do |line|
@@ -30,9 +32,9 @@ def alpha_columns
30
32
  _out "</table>"
31
33
  end
32
34
 
33
- def comment
34
- _body { } # ignore body
35
- end
35
+ # def comment
36
+ # _body { } # ignore body
37
+ # end
36
38
 
37
39
  def _errout(*args)
38
40
  ::STDERR.puts *args
@@ -48,12 +50,14 @@ def _slug(str)
48
50
  s2
49
51
  end
50
52
 
51
- def image
53
+
54
+ # FIXME duplicated?
55
+ def image(args = nil, body = nil)
52
56
  name = @_args[0]
53
57
  _out "<img src='#{name}'></img>"
54
58
  end
55
59
 
56
- def figure
60
+ def figure(args = nil, body = nil)
57
61
  name = @_args[0]
58
62
  num = @_args[1]
59
63
  title = @_args[2..-1].join(" ")
@@ -62,7 +66,7 @@ def figure
62
66
  _out "<center><b>Figure #{num}</b> #{title}</center>"
63
67
  end
64
68
 
65
- def chapter
69
+ def chapter(args = nil, body = nil)
66
70
  # _errout("chapter")
67
71
  @chapter = @_args.first.to_i
68
72
  @sec = @sec2 = 0
@@ -78,7 +82,7 @@ def chapter
78
82
  HTML
79
83
  end
80
84
 
81
- def chapterN
85
+ def chapterN(args = nil, body = nil)
82
86
  @chapter += 1
83
87
  @sec = @sec2 = 0
84
88
  title = @_data # .split(" ",2)[1]
@@ -94,7 +98,7 @@ def chapterN
94
98
  HTML
95
99
  end
96
100
 
97
- def sec
101
+ def sec(args = nil, body = nil)
98
102
  @sec += 1
99
103
  @sec2 = 0
100
104
  @section = "#@chapter.#@sec"
@@ -108,7 +112,7 @@ rescue => err
108
112
  exit
109
113
  end
110
114
 
111
- def subsec
115
+ def subsec(args = nil, body = nil)
112
116
  @sec2 += 1
113
117
  @subsec = "#@chapter.#@sec.#@sec2"
114
118
  title = @_data.dup
@@ -118,7 +122,7 @@ def subsec
118
122
  _out "<h3>#@subsec #{title}</h3>\n"
119
123
  end
120
124
 
121
- def definition_table
125
+ def definition_table(args = nil, body = nil)
122
126
  title = @_data
123
127
  wide = "95"
124
128
  delim = " :: "
@@ -140,7 +144,7 @@ def definition_table
140
144
  _optional_blank_line
141
145
  end
142
146
 
143
- def table2
147
+ def table2(args = nil, body = nil)
144
148
  title = @_data
145
149
  wide = "90"
146
150
  extra = _args[2]
@@ -164,7 +168,7 @@ def table2
164
168
  _optional_blank_line
165
169
  end
166
170
 
167
- def simple_table
171
+ def simple_table(args = nil, body = nil)
168
172
  title = @_data
169
173
  delim = " :: "
170
174
  _out "<table cellpadding=2>"
@@ -193,7 +197,7 @@ def simple_table
193
197
  _out "</table>"
194
198
  end
195
199
 
196
- def table
200
+ def table(args = nil, body = nil)
197
201
  @table_num ||= 0
198
202
  @table_num += 1
199
203
  title = @_data
@@ -227,7 +231,7 @@ def table
227
231
  _out "<b>Table #@chapter.#@table_num &nbsp;&nbsp; #{title}</b></center><br>"
228
232
  end
229
233
 
230
- def toc!
234
+ def toc!(args = nil, body = nil)
231
235
  _debug "Closing TOC"
232
236
  @toc.close
233
237
  rescue => err
@@ -236,7 +240,7 @@ rescue => err
236
240
  _errout "Exception: #{err.inspect}"
237
241
  end
238
242
 
239
- def toc2
243
+ def toc2(args = nil, body = nil)
240
244
  file = @_args[0]
241
245
  @toc.close
242
246
  ::File.write(file, <<-EOS)
@@ -249,24 +253,24 @@ EOS
249
253
  system("cat toc.tmp >>#{file}")
250
254
  end
251
255
 
252
- def missing
256
+ def missing(args = nil, body = nil)
253
257
  @toc << "#{_nbsp(8)}<font color=red>TBD: #@_data</font><br>"
254
258
  stuff = @_data.empty? ? "" : ": #@_data"
255
259
  _out "<br><font color=red><i>[Material missing#{stuff}]</i></font><br>\n "
256
260
  end
257
261
 
258
- def TBC
262
+ def TBC(args = nil, body = nil)
259
263
  @toc << "#{_nbsp(8)}<font color=red>To be continued...</font><br>"
260
264
  _out "<br><font color=red><i>To be continued...</i></font><br>"
261
265
  end
262
266
 
263
- def note
267
+ def note(args = nil, body = nil)
264
268
  _out "<br><font color=red><i>Note: "
265
269
  _out @_data
266
270
  _out "</i></font><br>\n "
267
271
  end
268
272
 
269
- def quote
273
+ def quote(args = nil, body = nil)
270
274
  _out "<blockquote>"
271
275
  _body {|line| _out line }
272
276
  _out "</blockquote>"
data/plugin/calibre.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- def epub!
3
+ def epub!(args = nil, body = nil)
4
4
  out = _format(@_args[0])
5
5
  src = @_args[1]
6
6
  @cover = @_args[2]