livetext 0.9.37 → 0.9.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 784ac1767694b1d098d3e289082070ef3e3df0aab15766cf42105e854da31730
4
- data.tar.gz: b6f62f1164873ec613b16067c53abc0e1b8906cacaeaae033bd5e862ca6b4bd5
3
+ metadata.gz: c1acd3333afca72468cfc97d2dcdf7d7018700e08d7c0defe4b68d7da53d0824
4
+ data.tar.gz: 32495892978828e9e75d619b9df32891829fd6d6fca9eea46efc5d372fc172c5
5
5
  SHA512:
6
- metadata.gz: 795730de451f27c2ffccf326fcc976e170ae884fef45d3bc732bb59826cc40bbff0e877d3ee3ed051fa3f20e0836ccede6668c42ba7a21ec1bf51910ebfc7a99
7
- data.tar.gz: 1db7dfbb839a6787872df65d591b49fb36db69f9d3ddc86805d981f19266c98abcac4a8bbe8efebdf1137ec674201a3b3f4e0f09d849116acb56f390eefd8cbd
6
+ metadata.gz: f8c3e9ad8689636fbe83f63117e75461a2a12ca8b716f96f26ca89752f8404093bfd77d1a25ec62dd200263a79f7584960c66a2a2df699b314d909cba82995a7
7
+ data.tar.gz: bee8d442bd0755f18c64851241907569d9150af1a051f04729d82bd84ca814049e14a71c1e9257caea9f26ad3af547ebaaf0a55012f837c37ea4cb2699b22283
@@ -11,6 +11,14 @@ class Livetext::Functions
11
11
  attr_accessor :param # kill this?
12
12
  end
13
13
 
14
+ def code_lines(param = nil)
15
+ $code_lines.to_i # FIXME pleeease
16
+ end
17
+
18
+ def ns(param = nil)
19
+ "\b"
20
+ end
21
+
14
22
  # FIXME Function parameters need to be fixed...
15
23
 
16
24
  def isqrt(param = nil) # "integer square root" - Just for testing
@@ -255,8 +255,3 @@ module Livetext::Helpers
255
255
 
256
256
  end
257
257
 
258
- =begin
259
- /Users/Hal/.rvm/gems/ruby-2.7.0/gems/livetext-0.9.35/lib/livetext/helpers.rb:125:in `invoke_dotcmd'
260
- /Users/Hal/.rvm/gems/ruby-2.7.0/gems/livetext-0.9.35/lib/livetext/helpers.rb:141:in `handle_dotcmd'
261
- /Users/Hal/.rvm/gems/ruby-2.7.0/gems/livetext-0.9.35/lib/livetext/helpers.rb:102:in `process_line'
262
- =end
@@ -74,16 +74,16 @@ module Livetext::Standard
74
74
  return true
75
75
  end
76
76
 
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
77
+ def h1(args = nil, body = nil); api.out html.tag(:h1, cdata: api.data); return true; end
78
+ def h2(args = nil, body = nil); api.out html.tag(:h2, cdata: api.data); return true; end
79
+ def h3(args = nil, body = nil); api.out html.tag(:h3, cdata: api.data); return true; end
80
+ def h4(args = nil, body = nil); api.out html.tag(:h4, cdata: api.data); return true; end
81
+ def h5(args = nil, body = nil); api.out html.tag(:h5, cdata: api.data); return true; end
82
+ def h6(args = nil, body = nil); api.out html.tag(:h6, cdata: api.data); return true; end
83
83
 
84
84
  def list(args = nil, body = nil)
85
85
  html.wrap :ul do
86
- api.body {|line| api.out html.tag(:li, line) }
86
+ api.body {|line| api.out html.tag(:li, cdata: line) }
87
87
  end
88
88
  api.optional_blank_line
89
89
  end
@@ -94,7 +94,7 @@ module Livetext::Standard
94
94
  loop do
95
95
  line = lines.next
96
96
  line = api.format(line)
97
- str = line[0] == " " ? line : wrapped(line, :li)
97
+ str = line[0] == " " ? line : html.tag(:li, cdata: line)
98
98
  api.out str
99
99
  end
100
100
  end
@@ -120,7 +120,7 @@ module Livetext::Standard
120
120
  def say(args = nil, body = nil)
121
121
  data = args || api.args.join(" ")
122
122
  str = api.format(data)
123
- TTY.puts "(say) #{str}"
123
+ TTY.puts str
124
124
  api.optional_blank_line
125
125
  end
126
126
 
@@ -128,7 +128,8 @@ module Livetext::Standard
128
128
  str = api.format(api.data)
129
129
  num = str.length
130
130
  decor = "-"*num + "\n"
131
- puts decor + str + "\n" + decor
131
+ api.tty decor + str + "\n" + decor
132
+ api.optional_blank_line
132
133
  end
133
134
 
134
135
  def quit(args = nil, body = nil)
@@ -199,7 +200,21 @@ module Livetext::Standard
199
200
  rhs = ""
200
201
  text.each_line do |line|
201
202
  str = api.format(line.chomp)
202
- rhs << str + "<br>"
203
+ rhs << str + "<br>\n"
204
+ end
205
+ indent = @parent.indentation.last
206
+ indented = " " * indent
207
+ api.setvar(var, rhs.chomp)
208
+ api.optional_blank_line
209
+ end
210
+
211
+ def heredoc!(args = nil, body = nil) # no <br>
212
+ var = api.args[0]
213
+ text = api.body.join("\n")
214
+ rhs = ""
215
+ text.each_line do |line|
216
+ str = api.format(line.chomp)
217
+ rhs << str + "\n"
203
218
  end
204
219
  indent = @parent.indentation.last
205
220
  indented = " " * indent
@@ -215,6 +230,20 @@ module Livetext::Standard
215
230
  api.optional_blank_line
216
231
  end
217
232
 
233
+ def cinclude(args = nil, body = nil) # dot command
234
+ file = api.expand_variables(api.args.first) # allows for variables
235
+ if api.args.size > 1 # there is an HTML file
236
+ processed = api.expand_variables(api.args[1])
237
+ if File.exist?(processed) && File.mtime(processed) > File.mtime(file)
238
+ api.args = [processed]
239
+ copy
240
+ end
241
+ end
242
+ check_file_exists(file)
243
+ @parent.process_file(file)
244
+ api.optional_blank_line
245
+ end
246
+
218
247
  def dot_include(args = nil, body = nil) # dot command
219
248
  file = api.expand_variables(api.args.first) # allows for variables
220
249
  check_file_exists(file)
@@ -334,10 +363,11 @@ module Livetext::Standard
334
363
  api.body do |line|
335
364
  line = api.format(line)
336
365
  term, defn = line.split(delim)
337
- api.out wrapped(term, :dt)
338
- api.out wrapped(defn, :dd)
366
+ api.out html.tag(:dt, cdata: term)
367
+ api.out " " + html.tag(:dd, cdata: defn)
339
368
  end
340
369
  end
370
+ api.out ""
341
371
  api.optional_blank_line
342
372
  end
343
373
 
@@ -351,13 +381,13 @@ module Livetext::Standard
351
381
  def xtable(args = nil, body = nil) # Borrowed from bookish - FIXME
352
382
  title = api.data
353
383
  delim = " :: "
354
- api.out "<br><center><table width=90% cellpadding=5>"
384
+ api.out "<br>\n\n<center><table width=90% cellpadding=5>"
355
385
  lines = api.body(true)
356
386
  maxw = nil
357
387
  processed = []
358
388
  lines.each do |line|
359
389
  line = api.format(line)
360
- line.gsub!(/\n+/, "<br>")
390
+ line.gsub!(/\n+/, "<br>\n")
361
391
  processed << line
362
392
  cells = line.split(delim)
363
393
  wide = cells.map {|cell| cell.length }
@@ -173,6 +173,7 @@ STDERR.puts "incfile: #{api.methods.sort.inspect}\n "
173
173
  def out(str = "", file = nil)
174
174
  return if str.nil?
175
175
  return file.puts str unless file.nil?
176
+ str.gsub!("\b ", "") # ignore spaces
176
177
  @live.body << str
177
178
  @live.body << "\n" unless str.end_with?("\n")
178
179
  end
@@ -2,5 +2,5 @@
2
2
  # Defining VERSION
3
3
 
4
4
  class Livetext
5
- VERSION = "0.9.37"
5
+ VERSION = "0.9.39"
6
6
  end
@@ -1,3 +1,53 @@
1
+ require 'fileutils'
2
+
3
+ def mobi(args = nil, body = nil)
4
+ out = api.format(api.args[0])
5
+ src = api.args[1]
6
+ @cover = api.args[2]
7
+ if ::File.directory?(src)
8
+ files = ::Dir["#{src}/*"].grep /\.html$/
9
+ files = files.sort # why is this necessary now?
10
+ cmd = "cat #{files.join(' ')} >TEMP.html"
11
+ system(cmd)
12
+ else
13
+ raise "Not supported yet"
14
+ end
15
+
16
+ cmd = "ebook-convert "
17
+ cmd << "TEMP.html #{out}.mobi "
18
+ cmd << "--cover #@cover " if @cover
19
+ system(cmd)
20
+
21
+ system("links -dump TEMP.html >/tmp/links.out")
22
+ str = `wc -w /tmp/links.out`
23
+ nw = str.split[0]
24
+ end
25
+
26
+ def epub(args = nil, body = nil)
27
+ out = api.format(api.args[0])
28
+ src = api.args[1]
29
+ @cover = api.args[2]
30
+ if ::File.directory?(src)
31
+ files = ::Dir["#{src}/*"].grep /\.html$/
32
+ files = files.sort # why is this necessary now?
33
+ cmd = "cat #{files.join(' ')} >TEMP.html"
34
+ system(cmd)
35
+ else
36
+ raise "Not supported yet"
37
+ end
38
+
39
+ cmd = "ebook-convert "
40
+ cmd << "TEMP.html #{out}.epub "
41
+ cmd << "--cover #@cover " if @cover
42
+ system(cmd)
43
+
44
+ system("links -dump TEMP.html >/tmp/links.out")
45
+ str = `wc -w /tmp/links.out`
46
+ nw = str.split[0]
47
+ puts "Approx words: #{nw}"
48
+ # ::FileUtils.rm("TEMP.html")
49
+ end
50
+
1
51
  def hardbreaks(args = nil, body = nil)
2
52
  @hard = false
3
53
  @hard = true unless api.args.first == "off"
@@ -78,7 +128,7 @@ def xchapterN(args = nil, body = nil)
78
128
  @chapter = api.args.first.to_i
79
129
  @sec = @sec2 = 0
80
130
  title = api.data.split(" ",2)[1]
81
- @toc << "<br><b>#@chapter</b> #{title}<br>"
131
+ @toc << "<br>\n\n<b>#@chapter</b> #{title}<br>\n\n"
82
132
  api.data = _slug(title)
83
133
  next_output
84
134
  api.out "<title>#{@chapter}. #{title}</title>"
@@ -94,7 +144,7 @@ def chapter(args = nil, body = nil)
94
144
  @sec = @sec2 = 0
95
145
  title = api.data # .split(" ",2)[1]
96
146
  _errout("Chapter #@chapter: #{title}")
97
- @toc << "<br><b>#@chapter</b> #{title}<br>"
147
+ @toc << "<br>\n\n<b>#@chapter</b> #{title}<br>\n\n"
98
148
  api.data = _slug(title)
99
149
  next_output
100
150
  api.out "<title>#{@chapter}. #{title}</title>"
@@ -110,10 +160,10 @@ def sec(args = nil, body = nil)
110
160
  @sec2 = 0
111
161
  @section = "#@chapter.#@sec"
112
162
  title = api.data.dup
113
- @toc << "#{_nbsp(3)}<b>#@section</b> #{title}<br>"
163
+ @toc << "#{_nbsp(3)}<b>#@section</b> #{title}<br>\n"
114
164
  api.data = _slug(api.data)
115
165
  next_output
116
- api.out "<h3>#@section #{title}</h3>\n"
166
+ api.out "<h3>#@section #{title}</h3>\n\n"
117
167
  api.optional_blank_line
118
168
  rescue => err
119
169
  api.tty "#{err}\n#{err.backtrace.join("\n")}"
@@ -125,10 +175,10 @@ def subsec(args = nil, body = nil)
125
175
  @sec2 += 1
126
176
  @subsec = "#@chapter.#@sec.#@sec2"
127
177
  title = api.data.dup
128
- @toc << "#{_nbsp(6)}<b>#@subsec</b> #{title}<br>"
178
+ @toc << "#{_nbsp(6)}<b>#@subsec</b> #{title}<br>\n"
129
179
  api.data = _slug(api.data)
130
180
  next_output
131
- api.out "<h3>#@subsec #{title}</h3>\n"
181
+ api.out "<h3>#@subsec #{title}</h3>\n\n"
132
182
  api.optional_blank_line
133
183
  end
134
184
 
@@ -136,7 +186,7 @@ def definition_table(args = nil, body = nil)
136
186
  title = api.data
137
187
  wide = "95"
138
188
  delim = " :: "
139
- api.out "<br><center><table width=#{wide}% cellpadding=5>"
189
+ api.out "<br>\n\n<center><table width=#{wide}% cellpadding=5>"
140
190
  lines = api.body(true)
141
191
  lines.map! {|line| api.format(line) }
142
192
 
@@ -149,7 +199,7 @@ def definition_table(args = nil, body = nil)
149
199
  end
150
200
  api.out "</tr>"
151
201
  end
152
- api.out "</table></center><br><br>"
202
+ api.out "</table></center>\n\n<br><br>\n\n"
153
203
 
154
204
  api.optional_blank_line
155
205
  end
@@ -159,7 +209,7 @@ def table2(args = nil, body = nil)
159
209
  wide = "90"
160
210
  extra = api.args[2]
161
211
  delim = " :: "
162
- api.out "<br><center><table width=#{wide}% cellpadding=5>"
212
+ api.out "<br>\n\n<center><table width=#{wide}% cellpadding=5>"
163
213
  lines = api.body(true)
164
214
  lines.map! {|line| api.format(line) }
165
215
 
@@ -173,7 +223,7 @@ def table2(args = nil, body = nil)
173
223
  end
174
224
  api.out "</tr>"
175
225
  end
176
- api.out "</table></center><br><br>"
226
+ api.out "</table></center>\n\n<br><br>\n\n"
177
227
  api.optional_blank_line
178
228
  end
179
229
 
@@ -212,11 +262,12 @@ def table(args = nil, body = nil)
212
262
  @table_num += 1
213
263
  title = api.data
214
264
  delim = " :: "
215
- api.out "<br><center><table width=90% cellpadding=5>"
265
+ api.out "<br>\n\n<center><table width=90% cellpadding=5>"
266
+
216
267
  lines = api.body(true)
268
+ # Find max width for each column
217
269
  maxw = nil
218
270
  lines.each do |line|
219
- api.format(line)
220
271
  cells = line.split(delim)
221
272
  wide = cells.map {|x| x.length }
222
273
  maxw = [0] * cells.size
@@ -224,21 +275,22 @@ def table(args = nil, body = nil)
224
275
  end
225
276
 
226
277
  sum = maxw.inject(0, :+)
227
- maxw.map! {|x| (x/sum*100).floor }
278
+ maxw.map! {|x| (x/sum*100.0).floor }
228
279
 
229
280
  lines.each do |line|
281
+ line = api.format(line)
230
282
  cells = line.split(delim)
231
283
  api.out "<tr>"
232
284
  cells.each.with_index do |cell, i|
233
- api.out " <td width=#{maxw}% valign=top>" +
234
- "#{cell}</td>"
285
+ api.out " <td width=#{maxw[i]}% valign=top>#{cell}</td>"
286
+ # api.out " <td valign=top>#{cell}</td>"
235
287
  end
236
288
  api.out "</tr>"
237
289
  end
238
290
  api.out "</table>"
239
- @toc << "#{_nbsp(8)}<b>Table #@chapter.#@table_num</b> #{title}<br>"
291
+ @toc << "#{_nbsp(8)}<b>Table #@chapter.#@table_num</b> #{title}<br>\n"
240
292
  # _next_output(_slug("table_#{title}"))
241
- api.out "<b>Table #@chapter.#@table_num &nbsp;&nbsp; #{title}</b></center><br>"
293
+ api.out "\n<br><b>Table #@chapter.#@table_num &nbsp;&nbsp; #{title}</b></center><br>\n\n"
242
294
  api.optional_blank_line
243
295
  end
244
296
 
@@ -267,20 +319,20 @@ EOS
267
319
  end
268
320
 
269
321
  def missing(args = nil, body = nil)
270
- @toc << "#{_nbsp(8)}<font color=red>TBD: #{api.data}</font><br>"
322
+ @toc << "#{_nbsp(8)}<font color=red>TBD: #{api.data}</font><br>\n"
271
323
  stuff = api.data.empty? ? "" : ": #{api.data}"
272
324
  api.out "<br><font color=red><i>[Material missing#{stuff}]</i></font><br>\n "
273
325
  api.optional_blank_line
274
326
  end
275
327
 
276
328
  def TBC(args = nil, body = nil)
277
- @toc << "#{_nbsp(8)}<font color=red>To be continued...</font><br>"
329
+ @toc << "#{_nbsp(8)}<font color=red>To be continued...</font><br>\n"
278
330
  api.out "<br><font color=red><i>To be continued...</i></font><br>"
279
331
  api.optional_blank_line
280
332
  end
281
333
 
282
334
  def note(args = nil, body = nil)
283
- api.out "<br><font color=red><i>Note: "
335
+ api.out "\n<br>\n<font color=red><i>Note: "
284
336
  api.out api.data
285
337
  api.out "</i></font><br>\n "
286
338
  api.optional_blank_line
@@ -296,7 +348,7 @@ rescue => err
296
348
  exit
297
349
  end
298
350
 
299
- def init_bookish
351
+ def init_booktool
300
352
  @_file_num = 0
301
353
  @toc_file = "toc.tmp"
302
354
  @toc = ::File.new(@toc_file, "w")
@@ -347,10 +399,8 @@ def _prep_next_output(args)
347
399
  *title = args # _next_output(tag, num)
348
400
  title = title.join(" ")
349
401
  slug = _slug(title)
350
- api.tty "title = #{title.inspect}"
351
402
  @_file_num += 1
352
403
  fname = "#{'%03d' % @_file_num}-#{slug}.html"
353
- api.tty "slug, fnum, fname= #{[slug, @_file_num, fname].inspect}"
354
404
  fname
355
405
  end
356
406
 
@@ -83,25 +83,19 @@ def self.pyg_finalize(code, lexer=:elixir)
83
83
  end
84
84
 
85
85
  def fragment(args = nil, body = nil)
86
+ $code_lines ||= 0 # FIXME later
86
87
  lang = api.args.empty? ? :elixir : api.args.first.to_sym # ruby or elixir
87
88
  api.args = []
88
89
  lines = api.body(true) # .to_a # raw
89
- result = send(lang, lines)
90
+ $code_lines += lines.size
91
+ result = send("format_#{lang}", lines)
90
92
  api.out result
91
- api.out "\n"
93
+ api.out "<br>\n"
92
94
  api.optional_blank_line
93
95
  rescue => err
94
96
  STDERR.puts "fragment Error: #{__method__} err = #{err}\n#{err.backtrace.join("\n")}"
95
97
  end
96
98
 
97
- def dammit(args = nil, body = nil)
98
- lines = api.body(true)
99
- api.out "BODY:"
100
- lines.each {|x| api.out x }
101
- api.out "END BODY"
102
- api.optional_blank_line
103
- end
104
-
105
99
  def code # FIXME ?
106
100
  text = ""
107
101
  api.body {|line| api.out " " + line }
@@ -138,26 +132,7 @@ end
138
132
  File.write("#{dir}/elixir.css", css)
139
133
  end
140
134
 
141
-
142
- def format_ruby(source, theme = "Github", back = "black")
143
- # theme/back not used now
144
- formatter = Rouge::Formatters::HTML.new
145
- lexer = Rouge::Lexers::Ruby.new
146
- body = formatter.format(lexer.lex(source))
147
- text = "<div class=rb_highlight>#{body}</div>"
148
- text
149
- end
150
-
151
- def format_elixir(source, theme = "Github", back = "black")
152
- # theme/back not used now
153
- formatter = Rouge::Formatters::HTML.new
154
- lexer = Rouge::Lexers::Elixir.new
155
- body = formatter.format(lexer.lex(source))
156
- text = "<div class=ex_highlight>#{body}</div>"
157
- text
158
- end
159
-
160
- def xruby
135
+ def ruby(args = nil, body = nil)
161
136
  file = api.args.first
162
137
  code = nil
163
138
  if file.nil?
@@ -171,7 +146,7 @@ end
171
146
  api.out html
172
147
  end
173
148
 
174
- def xelixir
149
+ def elixir(args = nil, body = nil)
175
150
  file = api.args.first
176
151
  code = nil
177
152
  if file.nil?
@@ -184,7 +159,29 @@ end
184
159
  api.out html
185
160
  end
186
161
 
187
- def ruby(lines)
162
+ def format_ruby(lines, theme = "Github", back = "black")
163
+ # theme/back not used now
164
+ source = lines
165
+ source = source.join("\n") if source.is_a?(Array)
166
+ formatter = Rouge::Formatters::HTML.new
167
+ lexer = Rouge::Lexers::Ruby.new
168
+ body = formatter.format(lexer.lex(source))
169
+ text = "<div class=rb_highlight>#{body}</div>"
170
+ text
171
+ end
172
+
173
+ def format_elixir(lines, theme = "Github", back = "black")
174
+ # theme/back not used now
175
+ source = lines
176
+ source = source.join("\n") if source.is_a?(Array)
177
+ formatter = Rouge::Formatters::HTML.new
178
+ lexer = Rouge::Lexers::Elixir.new
179
+ body = formatter.format(lexer.lex(source))
180
+ text = "<div class=ex_highlight>#{body}</div>"
181
+ text
182
+ end
183
+
184
+ def __ruby(lines)
188
185
  theme = :Github # default
189
186
  source = lines.join("\n")
190
187
  formatter = Rouge::Formatters::HTML.new
@@ -214,7 +211,7 @@ rescue => err
214
211
  end
215
212
 
216
213
 
217
- def elixir(lines)
214
+ def __elixir(lines)
218
215
  theme = :Github # default
219
216
  source = lines.join("\n")
220
217
  formatter = Rouge::Formatters::HTML.new
@@ -1,4 +1,4 @@
1
- .mixin bookish
1
+ .mixin booktool
2
2
 
3
3
  .simple_table
4
4
  this :: that
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.37
4
+ version: 0.9.39
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-09 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -52,13 +52,12 @@ files:
52
52
  - lib/livetext/userapi.rb
53
53
  - lib/livetext/version.rb
54
54
  - livetext.gemspec
55
- - plugin/bookish.rb
55
+ - plugin/booktool.rb
56
56
  - plugin/bootstrap_menu.rb
57
- - plugin/calibre.rb
57
+ - plugin/codetool.rb
58
58
  - plugin/livemagick.rb
59
59
  - plugin/markdown.rb
60
60
  - plugin/misc/navbar.rb
61
- - plugin/pyggish.rb
62
61
  - plugin/tutorial.rb
63
62
  - test/all.rb
64
63
  - test/extra/README.txt
@@ -142,10 +141,10 @@ files:
142
141
  - test/snapshots/import_bookish/expected-output.txt
143
142
  - test/snapshots/import_bookish/source.lt3
144
143
  - test/snapshots/import_bookish/toc.tmp
145
- - test/snapshots/mixin_bookish/expected-error.txt
146
- - test/snapshots/mixin_bookish/expected-output.txt
147
- - test/snapshots/mixin_bookish/source.lt3
148
- - test/snapshots/mixin_bookish/toc.tmp
144
+ - test/snapshots/mixin_booktool/expected-error.txt
145
+ - test/snapshots/mixin_booktool/expected-output.txt
146
+ - test/snapshots/mixin_booktool/source.lt3
147
+ - test/snapshots/mixin_booktool/toc.tmp
149
148
  - test/snapshots/more_complex_vars/expected-error.txt
150
149
  - test/snapshots/more_complex_vars/expected-output.txt
151
150
  - test/snapshots/more_complex_vars/source.lt3
@@ -220,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
219
  - !ruby/object:Gem::Version
221
220
  version: '0'
222
221
  requirements: []
223
- rubygems_version: 3.1.2
222
+ rubygems_version: 3.5.4
224
223
  signing_key:
225
224
  specification_version: 4
226
225
  summary: A smart processor for text
data/plugin/calibre.rb DELETED
@@ -1,26 +0,0 @@
1
- require 'fileutils'
2
-
3
- def epub!(args = nil, body = nil)
4
- out = api.format(api.args[0])
5
- src = api.args[1]
6
- @cover = api.args[2]
7
- if ::File.directory?(src)
8
- files = ::Dir["#{src}/*"].grep /\.html$/
9
- files = files.sort # why is this necessary now?
10
- cmd = "cat #{files.join(' ')} >TEMP.html"
11
- system(cmd)
12
- else
13
- raise "Not supported yet"
14
- end
15
-
16
- cmd = "ebook-convert "
17
- cmd << "TEMP.html #{out}.epub "
18
- cmd << "--cover #@cover " if @cover
19
- system(cmd)
20
-
21
- system("links -dump TEMP.html >/tmp/links.out")
22
- str = `wc -w /tmp/links.out`
23
- nw = str.split[0]
24
- puts "Approx words: #{nw}"
25
- # ::FileUtils.rm("TEMP.html")
26
- end