livetext 0.9.48 → 0.9.49

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: 91574e23cbcbe19d5c06d7c1fbbe8fbbe33ca29b06511da502b532bbb28519c6
4
- data.tar.gz: 553612fc90e8a6f3676158c3e98997415d0b568fb811fc9d273f8a2ae47478b0
3
+ metadata.gz: 8776c069073a940abd8ba05f8a16f30422eef3f1bb1e4c80faf61ec5708e163e
4
+ data.tar.gz: 9362abfe17f905ce154a940722f7cd15310549e3edaee35cd598c70df783a8e8
5
5
  SHA512:
6
- metadata.gz: 909f58be5cd6ee9d11262bb7213d2fab733d379ac678953c0e0225486cdc7a24152b8f5e5b208f2522bf4ea629abd9597c14b3cce1988b19c89b3b92d96f729b
7
- data.tar.gz: e6e9aaec3cba4d466601d9b4d2f2d96bbb3c3697640684d96c23d70b41843d6a5674a4f41e659355df45a72c59842f7e91df44c76455a430425836db17f1e8e7
6
+ metadata.gz: eccc4cded320e34b4d6db33eaee2cd3b6a0293e0e0907c6498d31fa2da1fe8d672ad3d7acae6160f858c8f0cd6e8f1302d647b00b8d3b1c1645d4cce53897d65
7
+ data.tar.gz: 8bf1348d9f97446d6f201e52b5759594a8f2608880bcefd4cbcb4b07a0e6d9934f4bf9f0b7a54f94524c6b932fa0999bd920fb23154d6c95fc052e00de949941
data/lib/livetext/core.rb CHANGED
@@ -55,6 +55,7 @@ class Livetext
55
55
  @no_puts = output.nil?
56
56
  @body = ""
57
57
  @main = Processor.new(self, output) # nil = make @main its own parent??
58
+ @parent = @main
58
59
  @indentation = [0]
59
60
  @_vars = Livetext::Vars
60
61
  @api = UserAPI.new(self)
@@ -86,14 +87,16 @@ class Livetext
86
87
  end
87
88
 
88
89
  def inspect
90
+ api_abbr = @api ? "(non-nil)" : "(not shown)"
91
+ main_abbr = @main ? "(non-nil)" : "(not shown)"
89
92
  "Livetext:\n" +
90
93
  " source = #{@source.inspect}\n" +
91
94
  " mixins = #{@_mixins.inspect}\n" +
92
95
  " import = #{@_mixins.inspect}\n" +
93
- " main = (not shown)\n" +
96
+ " main = #{main_abbr}\n" +
94
97
  " indent = #{@indentation.inspect}\n" +
95
98
  " vars = #{@_vars.inspect}\n" +
96
- " api = (not shown)\n" +
99
+ " api = #{api_abbr}\n" +
97
100
  " body = (#{@body.size} bytes)"
98
101
  end
99
102
 
@@ -73,7 +73,6 @@ module Livetext::Helpers
73
73
  ## FIXME process_file[!] should call process[_text] ?
74
74
 
75
75
  def process_file(fname, btrace=false)
76
- checkpoint "fname = #{fname.inspect}"
77
76
  unless File.exist?(fname)
78
77
  api.dump
79
78
  raise FileNotFound(fname)
@@ -126,7 +125,6 @@ checkpoint "fname = #{fname.inspect}"
126
125
  api.data = data0.dup # should permit _ in function names at least
127
126
  args0 = data0.split
128
127
  api.args = args0.dup
129
- checkpoint "name = #{name} args = #{args0.inspect}"
130
128
  retval = @main.send(name) # , *args) # was 125
131
129
  retval
132
130
  rescue => err
@@ -173,7 +171,7 @@ checkpoint "name = #{name} args = #{args0.inspect}"
173
171
  friendly_error DisallowedName(name) if disallowed?(name)
174
172
  end
175
173
 
176
- def check_file_exists(file)
174
+ def file_exists?(file)
177
175
  return File.exist?(file)
178
176
  end
179
177
 
@@ -11,6 +11,7 @@ make_exception(:FileNotFound, "Error: file '%1' not found")
11
11
  # Module Standard comprises most of the standard or "common" methods.
12
12
 
13
13
  module Livetext::Standard
14
+ include Livetext::GlobalHelpers
14
15
  include Livetext::Helpers
15
16
 
16
17
  TTY = ::File.open("/dev/tty", "w")
@@ -211,8 +212,8 @@ module Livetext::Standard
211
212
  str = api.format(line.chomp)
212
213
  rhs << str + "<br>\n"
213
214
  end
214
- indent = @parent.indentation.last
215
- indented = " " * indent
215
+ # indent = @parent.indentation.last
216
+ # indented = " " * indent
216
217
  api.setvar(var, rhs.chomp)
217
218
  api.optional_blank_line
218
219
  end
@@ -225,8 +226,8 @@ module Livetext::Standard
225
226
  str = api.format(line.chomp)
226
227
  rhs << str + "\n"
227
228
  end
228
- indent = @parent.indentation.last
229
- indented = " " * indent
229
+ # indent = @parent.indentation.last
230
+ # indented = " " * indent
230
231
  api.setvar(var, rhs.chomp)
231
232
  api.optional_blank_line
232
233
  end
@@ -256,7 +257,6 @@ module Livetext::Standard
256
257
  def dot_include(args = nil, body = nil) # dot command
257
258
  file = api.expand_variables(api.args.first) # allows for variables
258
259
  check_file_exists(file)
259
- checkpoint
260
260
  @parent.process_file(file)
261
261
  api.optional_blank_line
262
262
  end
@@ -299,7 +299,7 @@ checkpoint
299
299
 
300
300
  def copy(args = nil, body = nil)
301
301
  file = api.args.first
302
- ok = check_file_exists(file)
302
+ ok = file_exists?(file)
303
303
 
304
304
  self.parent.graceful_error FileNotFound(file) unless ok # FIXME seems weird?
305
305
  api.out grab_file(file)
@@ -15,6 +15,7 @@ class Livetext::UserAPI
15
15
 
16
16
  def initialize(live) # Livetext::UserAPI
17
17
  @live = live
18
+ @parent = live # FIXME experiment related to runeblog error
18
19
  @vars = live.vars
19
20
  @html = Livetext::HTML.new(self)
20
21
  @expander = Livetext::Expansion.new(live)
@@ -2,5 +2,5 @@
2
2
  # Defining VERSION
3
3
 
4
4
  class Livetext
5
- VERSION = "0.9.48"
5
+ VERSION = "0.9.49"
6
6
  end
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.48
4
+ version: 0.9.49
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-05-25 00:00:00.000000000 Z
11
+ date: 2024-11-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com