livetext 0.9.48 → 0.9.50

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: 27944c1a74ce15f08247c1453e770fc006863944daf0f2ee59972591af0f7410
4
+ data.tar.gz: 5640672eb2304b54876fd6a831ae72d59ac901b837364c62e73547ff20ad77b1
5
5
  SHA512:
6
- metadata.gz: 909f58be5cd6ee9d11262bb7213d2fab733d379ac678953c0e0225486cdc7a24152b8f5e5b208f2522bf4ea629abd9597c14b3cce1988b19c89b3b92d96f729b
7
- data.tar.gz: e6e9aaec3cba4d466601d9b4d2f2d96bbb3c3697640684d96c23d70b41843d6a5674a4f41e659355df45a72c59842f7e91df44c76455a430425836db17f1e8e7
6
+ metadata.gz: d9de0e56133dd2bd8abc152128134e4ca355f79853cb990e7fa836d7a4472d2b1181de85a27769f1606bd4ce7115135fb0f8b476a90268695faa72164a3e4894
7
+ data.tar.gz: 9fc0ffac185442cc5df8472cbfdd7814971fd27bfe4426df052dcf7c04709a1b4fe9c332bb3142b49edffc927afdc595bac061c2c3c3b6a4e9b978795bb06c59
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
 
@@ -1,4 +1,3 @@
1
-
2
1
  require_relative '../helpers'
3
2
 
4
3
  # Handle a .mixin
@@ -17,9 +16,14 @@ class Livetext::Handler::Mixin
17
16
 
18
17
  def self.get_module(filename, parent)
19
18
  handler = self.new(filename, parent)
19
+ STDERR.puts "handler was passed: #{filename}"
20
20
  modname, code = handler.read_mixin
21
+ STDERR.puts "Modname was: #{modname}\n\n "
22
+ STDERR.puts "Code was:\n=============\n#{code}\n==============\n "
21
23
  eval(code) # Avoid in the future
24
+ STDERR.puts "After eval"
22
25
  newmod = Object.const_get("::" + modname)
26
+ STDERR.puts "After const_get"
23
27
  newmod # return actual module
24
28
  end
25
29
 
@@ -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.50"
6
6
  end
@@ -26,7 +26,7 @@ end
26
26
  private def get_brand
27
27
  peek = @enum.peek
28
28
  arg = peek[6..-1]
29
- href, item, blank = get_href_title(arg)
29
+ href, item, _blank = get_href_title(arg)
30
30
  # doesn't honor @root... and blank is unused here
31
31
  if item =~ /\.(jpg|png|gif)$/i
32
32
  item = "<img src='#{item}'></img>"
@@ -50,6 +50,7 @@ private def slash_tags
50
50
  @classes = peek[9..-1]
51
51
  end
52
52
  line = @enum.next
53
+ line
53
54
  end
54
55
  end
55
56
 
@@ -95,7 +96,7 @@ private def handle_body
95
96
  @dropdowns = 1
96
97
  loop do
97
98
  line = @enum.next
98
- href, title, blank = get_href_title(line)
99
+ href, title, _blank = get_href_title(line)
99
100
  case line[0]
100
101
  when "-"
101
102
  no_children(href, title)
@@ -138,7 +139,7 @@ def html
138
139
  end
139
140
 
140
141
  def navbar
141
- @html = HTML.new(api)
142
+ @html = Livetext::HTML.new(api)
142
143
  # bootstrap
143
144
  @space = " "
144
145
  @enum = api.body.each
metadata CHANGED
@@ -1,14 +1,13 @@
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.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-25 00:00:00.000000000 Z
10
+ date: 2025-07-22 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: A smart text processor extensible in Ruby
14
13
  email: rubyhacker@gmail.com
@@ -205,7 +204,6 @@ homepage: https://github.com/Hal9000/livetext
205
204
  licenses:
206
205
  - Ruby
207
206
  metadata: {}
208
- post_install_message:
209
207
  rdoc_options: []
210
208
  require_paths:
211
209
  - lib
@@ -220,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
218
  - !ruby/object:Gem::Version
221
219
  version: '0'
222
220
  requirements: []
223
- rubygems_version: 3.2.3
224
- signing_key:
221
+ rubygems_version: 3.7.1
225
222
  specification_version: 4
226
223
  summary: A smart processor for text
227
224
  test_files: []