livetext 0.8.87 → 0.8.88

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ee705b74c12263a3020cd814da619d81c371a9d59f743c2111045d96f9fd7b6
4
- data.tar.gz: 9e600b7b9129c209cd076cf5c4d2f9c02cc20168ad3b748fa56615d56784bc49
3
+ metadata.gz: d581f4bdb4eb60d5a74be2f601cdd140428cfa781c1ad41047ad7e8372e9a526
4
+ data.tar.gz: 875be8550e6b0bb65aafe39d56457ccd19825fdf71b9ace4c0079e505b7896b8
5
5
  SHA512:
6
- metadata.gz: edf421e51e7c6f7909bbe4886e464b87cf291fd48a1fdbdef07e59b3209c116cec251cafb990497e9c8d9bc75887ca1f46df87a40ff21b1c736fef12023899b7
7
- data.tar.gz: 1a0710996604c583fcce4ef87d65d58a61b98c4dabb8e4df4c2f91995a162e2d6e8c8bf3d93613771789dd98492a5881baa3cc3d8c3b2120011ccb172e06cfaf
6
+ metadata.gz: 3c7f9858cdb40eb009d4c3f1951ea92b88ad91b9251c8cbac4cfa445d36b81d883dbb18ee94bc3c8a27842febb3ff82cd0439500db470c5f4441342d65f25fae
7
+ data.tar.gz: 0d89365d60e1c3375af7d1f34a819691fc5799e9490f3853587d5bad61be0c4cf2684f19bbafe8fd8abf284ae36ca47b71ad796313eabf1f49b59ede02a85972
data/bin/livetext CHANGED
@@ -8,12 +8,6 @@ def handle_lt3(src)
8
8
  abort "Unknown file extension" unless src =~ /.lt3$/
9
9
  end
10
10
 
11
- # Main
12
-
13
- x = Livetext.new
14
-
15
- @backtrace = false
16
-
17
11
  def usage
18
12
  puts <<-EOF
19
13
  Usage:
@@ -52,6 +46,12 @@ def usage
52
46
  exit
53
47
  end
54
48
 
49
+ # Main
50
+
51
+ x = Livetext.new
52
+
53
+ @backtrace = false
54
+
55
55
  usage if ARGV.empty?
56
56
 
57
57
  loop do
@@ -79,7 +79,7 @@ loop do
79
79
  lib = ARGV.shift
80
80
  system("cp #{lib} #{Livetext::Path}/../plugin/")
81
81
  when Object
82
- x.process_file(arg) # , @backtrace)
82
+ x.process_file(arg, true) # , @backtrace)
83
83
  end
84
84
  end
85
85
 
data/lib/livetext.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.87"
2
+ VERSION = "0.8.88"
3
3
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
4
4
  end
5
5
 
@@ -127,20 +127,21 @@ class Livetext
127
127
  puts "process_text: err = #{err}"
128
128
  # puts err.backtrace.join("\n")
129
129
  puts @body
130
+ @body = ""
130
131
  return @body
131
132
  end
132
133
 
133
134
  ## FIXME process_file[!] should call process[_text]
134
135
 
135
- def process_file(fname)
136
+ def process_file(fname, btrace=false)
136
137
  _setfile(fname)
137
138
  # up = Dir.pwd
138
139
  # Dir.chdir(File.dirname(fname))
139
- base = File.basename(fname)
140
- raise "No such file '#{fname}' to process" unless File.exist?(base)
141
- text = File.readlines(base)
140
+ # base = File.basename(fname)
141
+ # raise "No such file '#{fname}' to process" unless File.exist?(base)
142
+ text = File.readlines(fname)
142
143
  enum = text.each
143
- @backtrace = false
144
+ @backtrace = btrace
144
145
  @main.source(enum, fname, 0)
145
146
  loop do
146
147
  line = @main.nextline
@@ -153,6 +154,7 @@ return @body
153
154
  val
154
155
  rescue
155
156
  puts @body
157
+ @body = ""
156
158
  end
157
159
 
158
160
  def process_file!(fname, backtrace=false)
@@ -206,6 +208,7 @@ return @body
206
208
  rescue => err
207
209
  @main._error!(err)
208
210
  puts @body
211
+ @body = ""
209
212
  return @body
210
213
  end
211
214
 
data/lib/processor.rb CHANGED
@@ -36,7 +36,7 @@ class Livetext
36
36
  # puts "-- body = "
37
37
  puts @parent.body
38
38
  STDERR.puts "Error: #{err} (at #{where[1]} line #{where[2]})"
39
- STDERR.puts err.backtrace if err.respond_to?(:backtrace) && trace
39
+ STDERR.puts err.backtrace if err.respond_to?(:backtrace) # && trace
40
40
  exit if abort
41
41
  end
42
42
 
data/lib/standard.rb CHANGED
@@ -73,53 +73,58 @@ EOS
73
73
  end
74
74
 
75
75
  def quit
76
+ puts @body
77
+ @body = ""
76
78
  @output.close
77
- exit
79
+ # exit!
78
80
  end
79
81
 
80
- def outdir
81
- @_outdir = @_args.first
82
- _optional_blank_line
83
- end
84
-
85
- def outdir! # FIXME ?
86
- @_outdir = @_args.first
87
- raise "No output directory specified" if @_outdir.nil?
88
- raise "No output directory specified" if @_outdir.empty?
89
- system("rm -f #@_outdir/*.html")
90
- _optional_blank_line
91
- end
92
-
93
- def _output(name)
94
- @_outdir ||= "." # FIXME
95
- @output.close unless @output == STDOUT
96
- @output = File.open(@_outdir + "/" + name, "w")
97
- @output.puts "<meta charset='UTF-8'>\n\n"
98
- end
99
-
100
- def _append(name)
101
- @_outdir ||= "." # FIXME
102
- @output.close unless @output == STDOUT
103
- @output = File.open(@_outdir + "/" + name, "a")
104
- @output.puts "<meta charset='UTF-8'>\n\n"
105
- end
106
-
107
- def output
108
- name = @_args.first
109
- _debug "Redirecting output to: #{name}"
110
- _output(name)
111
- end
112
-
113
- def append
114
- file = @_args[0]
115
- _append(file)
116
- end
117
-
118
- def next_output
119
- tag, num = @_args
120
- _next_output(tag, num)
121
- _optional_blank_line
122
- end
82
+ # def outdir
83
+ # @_outdir = @_args.first
84
+ # _optional_blank_line
85
+ # end
86
+ #
87
+ # def outdir! # FIXME ?
88
+ # @_outdir = @_args.first
89
+ # raise "No output directory specified" if @_outdir.nil?
90
+ # raise "No output directory specified" if @_outdir.empty?
91
+ # system("rm -f #@_outdir/*.html")
92
+ # _optional_blank_line
93
+ # end
94
+ #
95
+ # def _output(name)
96
+ # @_outdir ||= "." # FIXME
97
+ # @output.puts @body
98
+ # @body = ""
99
+ # @output.close unless @output == STDOUT
100
+ # @output = File.open(@_outdir + "/" + name, "w")
101
+ # @output.puts "<meta charset='UTF-8'>\n\n"
102
+ # end
103
+ #
104
+ # def _append(name)
105
+ # @_outdir ||= "." # FIXME
106
+ # @output.close unless @output == STDOUT
107
+ # @output = File.open(@_outdir + "/" + name, "a")
108
+ # @output.puts "<meta charset='UTF-8'>\n\n"
109
+ # end
110
+ #
111
+ # def output
112
+ # name = @_args.first
113
+ # _debug "Redirecting output to: #{name}"
114
+ # _output(name)
115
+ # end
116
+ #
117
+ # def append
118
+ # file = @_args[0]
119
+ # _append(file)
120
+ # end
121
+ #
122
+ # def next_output
123
+ # tag, num = @_args
124
+ # _next_output(tag, num)
125
+ # _optional_blank_line
126
+ # end
127
+ #
123
128
 
124
129
  def cleanup
125
130
  @_args.each do |item|
@@ -131,12 +136,12 @@ EOS
131
136
  end
132
137
  end
133
138
 
134
- def _next_output(tag = "sec", num = nil)
135
- @_file_num = num ? num : @_file_num + 1
136
- @_file_num = @_file_num.to_i
137
- name = "#{'%03d' % @_file_num}-#{tag}.html"
138
- _output(name)
139
- end
139
+ # def _next_output(tag = "sec", num = nil)
140
+ # @_file_num = num ? num : @_file_num + 1
141
+ # @_file_num = @_file_num.to_i
142
+ # name = "#{'%03d' % @_file_num}-#{tag}.html"
143
+ # _output(name)
144
+ # end
140
145
 
141
146
  def _def
142
147
  name = @_args[0]
@@ -212,9 +217,11 @@ EOS
212
217
 
213
218
  def _include
214
219
  file = @_args.first
220
+ STDERR.puts "In #{Dir.pwd}\n - about to process #{file}\n"
215
221
 
216
222
  _check_existence(file, "No such include file '#{file}'")
217
223
  @parent.process_file(file)
224
+ STDERR.puts " ...finished"
218
225
  _optional_blank_line
219
226
  end
220
227
 
@@ -250,7 +257,9 @@ EOS
250
257
  Dir.chdir("..") { mixin }
251
258
  return
252
259
  else
253
- raise "No such mixin '#{name}"
260
+ STDERR.puts "No such mixin '#{name}"
261
+ puts @body
262
+ exit!
254
263
  end
255
264
  end
256
265
 
data/lib/userapi.rb CHANGED
@@ -136,6 +136,7 @@ module Livetext::UserAPI
136
136
 
137
137
  def _out(str = "")
138
138
  return if str.nil?
139
+ STDERR.puts "STR = #{str.inspect}"
139
140
  @parent.body << str
140
141
  @parent.body << "\n" unless str.end_with?("\n")
141
142
  end
data/plugin/bookish.rb CHANGED
@@ -223,6 +223,7 @@ def toc!
223
223
  @toc.close
224
224
  rescue => err
225
225
  puts @body
226
+ @body = ""
226
227
  _errout "Exception: #{err.inspect}"
227
228
  end
228
229
 
@@ -259,7 +260,7 @@ end
259
260
 
260
261
  def quote
261
262
  _out "<blockquote>"
262
- _out _body
263
+ _body {|line| _out line }
263
264
  _out "</blockquote>"
264
265
  end
265
266
 
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.87
4
+ version: 0.8.88
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-06-11 00:00:00.000000000 Z
11
+ date: 2019-09-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -149,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 2.7.7
152
+ rubygems_version: 3.0.4
154
153
  signing_key:
155
154
  specification_version: 4
156
155
  summary: A smart processor for text