livetext 0.8.95 → 0.8.96

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: 8d50c436a237a5e3f02b6619316c5ff37efa5d0c58e4d64eb5445c05f3a54dfa
4
- data.tar.gz: c849446d4dd970e89c3cace0a8f1af13e3eadc2918df35f6614dc99192cbbd80
3
+ metadata.gz: 61efdb7cdd7d3a5c6597796d18922ba7f405c7b421a35d7b8708031a3a1d56c3
4
+ data.tar.gz: f6452c5a4bc7c1c28154774e9847a6502072be8e63ecb33ba6e85799452c10a0
5
5
  SHA512:
6
- metadata.gz: b778d4a49af38754d8a35df8e8cf42da35933888d26a6e13dd65cf944991f0521fc7138f49d174e7c3e640a93b84c451b3877d5424793e0cf4cd2af580964e66
7
- data.tar.gz: 620dac5c5eca194d84cf758ceddf738ad5bc41c8574ac110d6599bb5e5542857781e7dd66a4710e3a416490cb7934063b3f826860aa26172bc8f633ad7f562d1
6
+ metadata.gz: cc2c1c48f54e7411a9f6571256fa8ba1612d7e056010440a86be6d4038b1593c3771032f9305024d9fa0adfdc6543893a0f4183b435c22aab66cd40684b679e8
7
+ data.tar.gz: d45545ba38eec5669650e7171c285acc1627599fadce73cb80b5c3c7b38e9ef01be1d12ca4bbfd54e89d8e9c6b8e45b7779b7685cdb46812b64a5f6dae6471f4
@@ -325,6 +325,9 @@ class FormatLine
325
325
  end
326
326
  grab if param && curr == "]" # skip right bracket
327
327
  add str
328
+ rescue => err
329
+ STDERR.puts "ERR = #{err}\n#{err.backtrace}"
330
+ STDERR.puts "=== str = #{str.inspect}"
328
331
  end
329
332
 
330
333
  ############
@@ -29,7 +29,7 @@ class Livetext::Functions # Functions will go here... user-def AND pre-def??
29
29
 
30
30
  def link(param=nil)
31
31
  text, url = param.split("|", 2) # reverse these?
32
- "<a href='#{url}'>#{text}</a>"
32
+ "<a style='text-decoration: none' href='#{url}'>#{text}</a>"
33
33
  end
34
34
 
35
35
  def br(n="1")
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.95"
2
+ VERSION = "0.8.96"
3
3
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
4
4
  end
5
5
 
@@ -97,6 +97,11 @@ class Livetext
97
97
  end
98
98
  end
99
99
 
100
+ def xform_file(file)
101
+ self.process_file(file)
102
+ self.body
103
+ end
104
+
100
105
  def transform(text)
101
106
  _setfile!("(string)")
102
107
  @output = ::Livetext.output
@@ -198,10 +198,12 @@ EOS
198
198
  end
199
199
 
200
200
  def variables
201
+ prefix = _args[0]
201
202
  _body.each do |line|
202
203
  next if line.strip.empty?
203
204
  var, val = line.split(" ", 2)
204
205
  val = FormatLine.var_func_parse(val)
206
+ var = prefix + "." + var if prefix
205
207
  @parent._setvar(var, val)
206
208
  end
207
209
  end
@@ -443,7 +445,7 @@ EOS
443
445
  def link
444
446
  url = _args.first
445
447
  text = _args[2..-1].join(" ")
446
- _out "<a href='#{url}'>#{text}</a>"
448
+ _out "<a style='text-decoration: none' href='#{url}'>#{text}</a>"
447
449
  end
448
450
 
449
451
  def xtable # Borrowed from bookish - FIXME
@@ -45,16 +45,10 @@ module Livetext::UserAPI
45
45
  end
46
46
 
47
47
  def _end?(str)
48
- indent = ""
49
- # n = @parent.indentation.last - 1
50
- # n = 0 if n < 0 # Gahhh FIXM
51
- # indent = " " * n
52
- # indent << "$" unless indent.empty?
53
- return false if str.nil?
54
- cmd = indent + Livetext::Sigil + "end"
55
- return false if str.index(cmd) != 0
56
- return false unless _trailing?(str[5])
57
- return true
48
+ str = str.dup
49
+ str.gsub!(/^ */, "")
50
+ return true if str == ".end" || str == "$.end"
51
+ return false
58
52
  end
59
53
 
60
54
  def _raw_body(tag = "__EOF__")
@@ -83,19 +77,17 @@ module Livetext::UserAPI
83
77
  @line = nextline
84
78
  break if @line.nil?
85
79
  @line.chomp!
80
+ # STDERR.puts "LINE = #{@line.inspect}"
86
81
  if _end?(@line)
87
82
  end_found = true
88
83
  break
89
84
  end
90
85
  next if _comment?(@line)
91
- flag = (@line.include?("og:title"))
92
86
  # FIXME Will cause problem with $. ?
93
- # STDERR.puts "lt3: _body @line = #{@line.inspect}" if flag
94
87
  @line = _format(@line) unless raw
95
- # STDERR.puts " @line = #{@line.inspect}" if flag
96
88
  lines << @line
97
89
  end
98
- raise unless end_found
90
+ raise "this stupid error again" unless end_found
99
91
  _optional_blank_line
100
92
  if block_given?
101
93
  lines.each {|line| yield line } # FIXME what about $. ?
@@ -106,7 +98,9 @@ flag = (@line.include?("og:title"))
106
98
  str = "Fake error? 'Expecting .end, found end of file'\n"
107
99
  str << err.inspect + "\n"
108
100
  str << err.backtrace.map {|x| " " + x }.join("\n")
109
- _error!(str)
101
+ STDERR.puts str
102
+ exit
103
+ # _error!(str)
110
104
  end
111
105
 
112
106
  def _body_text(raw=false)
@@ -118,8 +118,11 @@ def sec
118
118
  @section = "#@chapter.#@sec"
119
119
  # _errout("section #@section")
120
120
  @toc << "#{_nbsp(3)}<b>#@section</b> #@_data<br>"
121
- # _next_output(_slug(@_data))
121
+ _next_output(_slug(@_data))
122
122
  _out "<h3>#@section #{@_data}</h3>\n"
123
+ rescue => err
124
+ STDERR.puts "#{err}\n#{err.backtrace}"
125
+ exit
123
126
  end
124
127
 
125
128
  def subsec
@@ -127,7 +130,7 @@ def subsec
127
130
  @subsec = "#@chapter.#@sec.#@sec2"
128
131
  @toc << "#{_nbsp(6)}<b>#@subsec</b> #@_data<br>"
129
132
  # _errout("section #@subsec")
130
- # _next_output(_slug(@_data))
133
+ _next_output(_slug(@_data))
131
134
  _out "<h3>#@subsec #{@_data}</h3>\n"
132
135
  end
133
136
 
@@ -222,8 +225,8 @@ def toc!
222
225
  _debug "Closing TOC"
223
226
  @toc.close
224
227
  rescue => err
225
- puts @body
226
- @body = ""
228
+ puts @parent.body
229
+ @parent.body = ""
227
230
  _errout "Exception: #{err.inspect}"
228
231
  end
229
232
 
@@ -242,9 +245,8 @@ end
242
245
 
243
246
  def missing
244
247
  @toc << "#{_nbsp(8)}<font color=red>TBD: #@_data</font><br>"
245
- _print "<br><font color=red><i>[Material missing"
246
- _print ": #@_data" unless @_data.empty?
247
- _out "]</i></font><br>\n "
248
+ stuff = @_data.empty? ? "" : ": #@_data"
249
+ _print "<br><font color=red><i>[Material missing#{stuff}]</i></font><br>\n "
248
250
  end
249
251
 
250
252
  def TBC
@@ -262,6 +264,9 @@ def quote
262
264
  _out "<blockquote>"
263
265
  _body {|line| _out line }
264
266
  _out "</blockquote>"
267
+ rescue => err
268
+ STDERR.puts "#{err}\n#{err.backtrace}"
269
+ exit
265
270
  end
266
271
 
267
272
  def init_bookish
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.8.95
4
+ version: 0.8.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com