livetext 0.9.21 → 0.9.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/imports/bookish.rb +8 -10
  3. data/imports/pyggish.rb +2 -34
  4. data/imports/tutorial.rb +2 -2
  5. data/lib/cmdargs.rb +2 -3
  6. data/lib/formatline.rb +101 -73
  7. data/lib/functions.rb +16 -1
  8. data/lib/handler/{icanhaz.rb → import.rb} +1 -1
  9. data/lib/handler.rb +1 -1
  10. data/lib/helpers.rb +10 -10
  11. data/lib/livetext.rb +12 -5
  12. data/lib/parser/set.rb +1 -3
  13. data/lib/parser/string.rb +2 -2
  14. data/lib/processor.rb +6 -2
  15. data/lib/standard.rb +15 -15
  16. data/lib/userapi.rb +4 -2
  17. data/plugin/bookish.rb +4 -5
  18. data/plugin/pyggish.rb +45 -77
  19. data/plugin/tutorial.rb +0 -1
  20. data/test/snapshots/error_inc_line_num/actual-error.txt +14 -0
  21. data/test/snapshots/error_inc_line_num/actual-output.txt +7 -0
  22. data/test/snapshots/error_inc_line_num/out-sdiff.txt +14 -0
  23. data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
  24. data/test/snapshots/{icanhaz2/expected-error.txt → error_invalid_name/actual-output.txt} +0 -0
  25. data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
  26. data/test/snapshots/error_missing_end/actual-error.txt +10 -0
  27. data/test/snapshots/error_missing_end/actual-output.txt +0 -0
  28. data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
  29. data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
  30. data/test/snapshots/error_no_such_copy/actual-output.txt +0 -0
  31. data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
  32. data/test/snapshots/error_no_such_inc/actual-output.txt +0 -0
  33. data/test/snapshots/error_no_such_mixin/actual-error.txt +13 -0
  34. data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
  35. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +6 -0
  36. data/test/snapshots/import/actual-error.txt +13 -0
  37. data/test/snapshots/import/actual-output.txt +0 -0
  38. data/test/snapshots/{icanhaz → import}/expected-output.txt +0 -0
  39. data/test/snapshots/{icanhaz → import}/match-error.txt +0 -0
  40. data/test/snapshots/import/out-sdiff.txt +6 -0
  41. data/test/snapshots/{icanhaz → import}/simple_import.rb +0 -0
  42. data/test/snapshots/{icanhaz → import}/source.lt3 +2 -2
  43. data/test/snapshots/import2/expected-error.txt +0 -0
  44. data/test/snapshots/{icanhaz2 → import2}/expected-output.txt +3 -1
  45. data/test/snapshots/{icanhaz2/simple_canhaz.rb → import2/simple_import.rb} +0 -0
  46. data/test/snapshots/import2/source.lt3 +8 -0
  47. data/test/snapshots/more_functions/expected-error.txt +0 -0
  48. data/test/snapshots/more_functions/expected-output.txt +37 -0
  49. data/test/snapshots/more_functions/source.lt3 +40 -0
  50. data/test/snapshots/simple_import/expected-output.txt +2 -0
  51. data/test/snapshots/simple_import/source.lt3 +3 -1
  52. data/test/snapshots/subset.txt +11 -12
  53. data/test/snapshots/wtf_bookish/expected-error.txt +0 -0
  54. data/test/snapshots/wtf_bookish/expected-output.txt +10 -0
  55. data/test/snapshots/wtf_bookish/source.lt3 +7 -0
  56. data/test/snapshots/wtf_bookish/toc.tmp +0 -0
  57. data/test/snapshots.rb +6 -7
  58. data/test/unit/formatline.rb +252 -135
  59. data/test/unit/parser/set.rb +6 -10
  60. data/test/unit/parser/string.rb +5 -5
  61. data/test/unit/standard.rb +0 -1
  62. metadata +37 -13
  63. data/lib/livetext/importable.rb +0 -2
  64. data/lib/parser/import.rb +0 -15
  65. data/test/snapshots/icanhaz2/source.lt3 +0 -6
data/lib/standard.rb CHANGED
@@ -101,7 +101,7 @@ module Livetext::Standard
101
101
  end
102
102
 
103
103
  def errout(args = nil, body = nil)
104
- STDERR.puts @_data.chomp
104
+ ::STDERR.puts @_data.chomp
105
105
  _optional_blank_line
106
106
  end
107
107
 
@@ -225,32 +225,25 @@ module Livetext::Standard
225
225
 
226
226
  def mixin(args = nil, body = nil)
227
227
  name = @_args.first # Expect a module name
228
+ # TTY.puts "#{__method__}: name = #{name}"
228
229
  return if @_mixins.include?(name)
229
230
  @_mixins << name
230
- mod = Livetext::ParseMixin.get_module(name) # FIXME??
231
+ mod = Livetext::ParseMixin.get_module(name)
232
+ # TTY.puts "#{__method__}: mod = #{mod.inspect}"
231
233
  self.extend(mod)
232
234
  init = "init_#{name}"
233
- self.send(init) if self.respond_to? init
235
+ self.send(init) rescue nil # if self.respond_to? init
234
236
  _optional_blank_line
235
237
  end
236
238
 
237
- def icanhaz(args = nil, body = nil)
239
+ def import(args = nil, body = nil)
238
240
  name = @_args.first # Expect a module name
239
241
  return if @_mixins.include?(name)
240
242
  @_mixins << name
241
- mod = Livetext::Handler::ICanHaz.get_module(name) # FIXME??
243
+ mod = Livetext::Handler::Import.get_module(name)
242
244
  self.extend(mod)
243
245
  init = "init_#{name}"
244
- self.send(init) if self.respond_to? init
245
- _optional_blank_line
246
- end
247
-
248
- def import(args = nil, body = nil)
249
- name = @_args.first # Expect a module name
250
- return if @_mixins.include?(name)
251
- @_mixins << name
252
- mod = Livetext::ParseImport.get_module(name)
253
- parse.use_import(name)
246
+ self.send(init) rescue nil # if self.respond_to? init
254
247
  _optional_blank_line
255
248
  end
256
249
 
@@ -367,4 +360,11 @@ module Livetext::Standard
367
360
  _out out
368
361
  end
369
362
 
363
+ def reflection # strictly experimental!
364
+ list = self.methods
365
+ obj = Object.instance_methods
366
+ diff = (list - obj).sort
367
+ _out "#{diff.size} methods:"
368
+ _out diff.inspect
369
+ end
370
370
  end
data/lib/userapi.rb CHANGED
@@ -1,11 +1,13 @@
1
- # User API
2
-
3
1
  require_relative 'formatline'
4
2
 
5
3
  # UserAPI deals mostly with user-level methods.
6
4
 
7
5
  module Livetext::UserAPI
8
6
 
7
+ # FIXME I am tired of all my leading underscores...
8
+ # FIXME Q: Could this be converted into a class?? What about its
9
+ # interaction thru instance vars?
10
+
9
11
  def setvar(var, val)
10
12
  str, sym = var.to_s, var.to_sym
11
13
  Livetext::Vars[str] = val
data/plugin/bookish.rb CHANGED
@@ -18,7 +18,7 @@ def h2; _out "<h2>#{@_data}</h2>"; end
18
18
  def h3; _out "<h3>#{@_data}</h3>"; end
19
19
 
20
20
  def alpha_columns(args = nil, body = nil)
21
- n = @_args.first.to_i # FIXME: what if missing?
21
+ n = @_args.first.to_i # FIXME: what if it's missing?
22
22
  words = []
23
23
  _body do |line|
24
24
  words << line.chomp
@@ -50,8 +50,8 @@ def _slug(str)
50
50
  s2
51
51
  end
52
52
 
53
-
54
53
  # FIXME duplicated?
54
+
55
55
  def image(args = nil, body = nil)
56
56
  name = @_args[0]
57
57
  _out "<img src='#{name}'></img>"
@@ -67,7 +67,6 @@ def figure(args = nil, body = nil)
67
67
  end
68
68
 
69
69
  def chapter(args = nil, body = nil)
70
- # _errout("chapter")
71
70
  @chapter = @_args.first.to_i
72
71
  @sec = @sec2 = 0
73
72
  title = @_data.split(" ",2)[1]
@@ -108,7 +107,7 @@ def sec(args = nil, body = nil)
108
107
  next_output
109
108
  _out "<h3>#@section #{title}</h3>\n"
110
109
  rescue => err
111
- STDERR.puts "#{err}\n#{err.backtrace}"
110
+ ::STDERR.puts "#{err}\n#{err.backtrace}"
112
111
  exit
113
112
  end
114
113
 
@@ -275,7 +274,7 @@ def quote(args = nil, body = nil)
275
274
  _body {|line| _out line }
276
275
  _out "</blockquote>"
277
276
  rescue => err
278
- STDERR.puts "#{err}\n#{err.backtrace}"
277
+ ::STDERR.puts "#{err}\n#{err.backtrace}"
279
278
  exit
280
279
  end
281
280
 
data/plugin/pyggish.rb CHANGED
@@ -1,59 +1,56 @@
1
1
  require 'rouge'
2
2
 
3
- def self.pyg_change(code, klass, style)
4
- color = style[0..6]
5
- modifier = style[8]
6
- mod_open = modifier ? "<#{modifier}>" : ""
7
- mod_close = modifier ? "</#{modifier}>" : ""
8
- rx = /<span class="#{klass}">(?<cname>[^<]+?)<\/span>/
9
- loop do
10
- md = rx.match(code)
11
- break if md.nil?
12
- str = md[:cname]
13
- result = code.sub!(rx, "<font color=#{color}>#{mod_open}#{str}#{mod_close}</font>")
14
- break if result.nil?
15
- end
16
- end
17
-
18
- def self._codebar_color(lexer)
19
- color = case lexer
20
- when :elixir
21
- "#fc88fc"
22
- when :ruby
23
- "#fc8888"
24
- else
25
- raise "Unknown lexer"
26
- end
3
+ # FIXME This whole file has a weird vibe. It has dead code and
4
+ # also exposes methods that are not dot commands...
5
+
6
+ def self.pyg_change(code, klass, style)
7
+ color = style[0..6]
8
+ modifier = style[8]
9
+ mod_open = modifier ? "<#{modifier}>" : ""
10
+ mod_close = modifier ? "</#{modifier}>" : ""
11
+ rx = /<span class="#{klass}">(?<cname>[^<]+?)<\/span>/
12
+ loop do
13
+ md = rx.match(code)
14
+ break if md.nil?
15
+ str = md[:cname]
16
+ result = code.sub!(rx, "<font color=#{color}>#{mod_open}#{str}#{mod_close}</font>")
17
+ break if result.nil?
27
18
  end
19
+ end
28
20
 
29
- def self.pyg_finalize(code, lexer=:elixir)
30
- Styles.each_pair {|klass, style| pyg_change(code, klass, style) }
31
- File.open("debug-pf1", "w") {|f| f.puts code }
32
- code.sub!(/<pre>/, "<pre>\n")
33
- code.gsub!(/<span class="[np]">/, "")
34
- code.gsub!(/<\/span>/, "")
35
- color = _codebar_color(lexer)
36
- code.sub!(/<td class="linenos"/, "<td width=2%></td><td width=5% bgcolor=#{color}")
37
- code.gsub!(/<td/, "<td valign=top ")
38
- code.gsub!(/ class="[^"]*?"/, "") # Get rid of remaining Pygments CSS
39
- File.open("debug-pf2", "w") {|f| f.puts code }
40
- lines = code.split("\n")
41
- # lines.each {|line| line << "\n" }
42
- n1 = lines.index {|x| x =~ /<pre>/ }
43
- n2 = lines.index {|x| x =~ /<\/pre>/ }
44
- # FIXME ?
45
- n1 ||= 0
46
- n2 ||= -1
47
- lines[n1].sub!(/ 1$/, " 1 ")
48
- (n1+1).upto(n2) {|n| lines[n].replace(" " + lines[n] + " ") }
49
- code = lines.join("\n")
50
- File.open("debug-pf3", "w") {|f| f.puts code }
51
- code
21
+ def self._codebar_color(lexer)
22
+ color = case lexer
23
+ when :elixir
24
+ "#fc88fc"
25
+ when :ruby
26
+ "#fc8888"
27
+ else
28
+ raise "Unknown lexer"
52
29
  end
30
+ end
53
31
 
32
+ def self.pyg_finalize(code, lexer=:elixir)
33
+ Styles.each_pair {|klass, style| pyg_change(code, klass, style) }
34
+ code.sub!(/<pre>/, "<pre>\n")
35
+ code.gsub!(/<span class="[np]">/, "")
36
+ code.gsub!(/<\/span>/, "")
37
+ color = _codebar_color(lexer)
38
+ code.sub!(/<td class="linenos"/, "<td width=2%></td><td width=5% bgcolor=#{color}")
39
+ code.gsub!(/<td/, "<td valign=top ")
40
+ code.gsub!(/ class="[^"]*?"/, "") # Get rid of remaining Pygments CSS
41
+ lines = code.split("\n")
42
+ n1 = lines.index {|x| x =~ /<pre>/ }
43
+ n2 = lines.index {|x| x =~ /<\/pre>/ }
44
+ # FIXME ?
45
+ n1 ||= 0
46
+ n2 ||= -1
47
+ lines[n1].sub!(/ 1$/, " 1 ")
48
+ (n1+1).upto(n2) {|n| lines[n].replace(" " + lines[n] + " ") }
49
+ code = lines.join("\n")
50
+ code
51
+ end
54
52
 
55
53
  def _process_code(text)
56
- File.open("debug-pc1", "w") {|f| f.puts text }
57
54
  lines = text.split("\n")
58
55
  lines = lines.select {|x| x !~ /##~ omit/ }
59
56
  @refs = {}
@@ -66,7 +63,6 @@ File.open("debug-pc1", "w") {|f| f.puts text }
66
63
  end
67
64
  lines.map! {|line| " " + line }
68
65
  text2 = lines.join("\n")
69
- File.open("debug-pc2", "w") {|f| f.puts text2 }
70
66
  text.replace(text2)
71
67
  end
72
68
 
@@ -86,34 +82,6 @@ def _colorize!(code, lexer=:elixir)
86
82
  result
87
83
  end
88
84
 
89
- def OLD_ruby
90
- file = @_args.first
91
- if file.nil?
92
- code = "# Ruby code\n"
93
- _body {|line| code << line + "\n" }
94
- else
95
- code = "# Ruby code\n\n" + ::File.read(file)
96
- end
97
-
98
- _process_code(code)
99
- html = _colorize(code, :ruby)
100
- _out "\n#{html}\n "
101
- end
102
-
103
- def OLD_elixir
104
- file = @_args.first
105
- if file.nil?
106
- code = ""
107
- _body {|line| code << line + "\n" }
108
- else
109
- code = ::File.read(file)
110
- end
111
-
112
- _process_code(code)
113
- html = _colorize(code, :elixir)
114
- _out "\n#{html}\n "
115
- end
116
-
117
85
  def fragment
118
86
  lang = @_args.empty? ? :elixir : @_args.first.to_sym # ruby or elixir
119
87
  @_args = []
data/plugin/tutorial.rb CHANGED
@@ -52,7 +52,6 @@ def inout(args = nil, body = nil)
52
52
  end
53
53
 
54
54
  def put_table(src, exp)
55
- STDERR.puts "put_table: #{[src, exp].inspect}"
56
55
  t1 = ::File.readlines(src) rescue (abort "Fail - src = #{src} t1 = #{src}")
57
56
  t2 = ::File.readlines(exp) rescue (abort "Fail - src = #{exp} t2 = #{out}")
58
57
  t1 = t1.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
@@ -0,0 +1,14 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:121:in `handle_dotcmd': Name 'foobar' is unknown (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:210:in `dot_include'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
11
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
12
+ from ../../../bin/livetext:86:in `block in <main>'
13
+ from ../../../bin/livetext:57:in `loop'
14
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,7 @@
1
+ This is my
2
+ source file
3
+ which includes file2 here:
4
+ This is file2
5
+ which has an error
6
+ about an unknown command
7
+ in line 5
@@ -0,0 +1,14 @@
1
+ ACTUAL | EXPECTED
2
+ This is my This is my
3
+ source file source file
4
+ which includes file2 here: which includes file2 here:
5
+ This is file2 This is file2
6
+ which has an error which has an error
7
+ about an unknown command about an unknown command
8
+ in line 5 in line 5
9
+ > <p>
10
+ >
11
+ > And this is file2 line 7.
12
+ > And here we are
13
+ > back in the
14
+ > original file.
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:140:in `check_disallowed': Error: name 'to_s' is invalid (DisallowedName)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:142:in `dot_def'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > This file has
3
+ > a defined method
4
+ > that is invalid:
5
+ > <p>
6
+ >
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/userapi.rb:92:in `_body': Expected .end, found end of file (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:48:in `comment'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Blah
3
+ > blah
4
+ > <p>
5
+ >
6
+ >
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:144:in `check_file_exists': Error: file 'nosuchfile.txt' not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:252:in `copy'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:144:in `check_file_exists': Error: file 'nosuchinc.lt3' not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:209:in `dot_include'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,13 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:34:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:12:in `initialize'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `new'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `get_module'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:231:in `mixin'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
11
+ from ../../../bin/livetext:86:in `block in <main>'
12
+ from ../../../bin/livetext:57:in `loop'
13
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Test that
3
+ > we give an error
4
+ > when a mixin does not
5
+ > exist:
6
+ > <p>
@@ -0,0 +1,13 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:34:in `find_file': No such mixin 'nonexistent' (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:9:in `initialize'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:13:in `new'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:13:in `get_module'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:243:in `import'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
11
+ from ../../../bin/livetext:86:in `block in <main>'
12
+ from ../../../bin/livetext:57:in `loop'
13
+ from ../../../bin/livetext:57:in `<main>'
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Test fake command .icanhaz:
3
+ > we give an error
4
+ > when a .rb does not
5
+ > exist:
6
+ > <p>
File without changes
@@ -1,9 +1,9 @@
1
- Test fake command .icanhaz:
1
+ Test .import:
2
2
  we give an error
3
3
  when a .rb does not
4
4
  exist:
5
5
 
6
- .icanhaz nonexistent
6
+ .import nonexistent
7
7
 
8
8
  We shouldn't
9
9
  reach this point
File without changes
@@ -1,6 +1,8 @@
1
- Testing fake command .icanhaz:
1
+ Testing .import:
2
2
  <p>
3
3
 
4
4
  Now call a method:
5
5
  Hello, world.
6
+ <p>
7
+
6
8
  That's all.
@@ -0,0 +1,8 @@
1
+ Testing .import:
2
+
3
+ .import simple_import
4
+
5
+ Now call a method:
6
+ .hello_world
7
+
8
+ That's all.
File without changes
@@ -0,0 +1,37 @@
1
+ Testing some more functions here...
2
+ <p>
3
+
4
+ Here I am calling a function with
5
+ a colon parameter...
6
+ <p>
7
+
8
+ <p>
9
+
10
+ Next let's <b>do*</b> something with our parameter:
11
+ <p>
12
+
13
+ I'll call these variants...
14
+ <p>
15
+
16
+ "Motel" spelled backwards is letom :)
17
+ <p>
18
+
19
+ "lamina" reversed is animal
20
+ <p>
21
+
22
+ I can also use the erutaef tekcarb here.
23
+ <p>
24
+
25
+ If I don't use a parameter for [Error evaluating $$reverse()] - it gives
26
+ me an error. (Bug or feature??)
27
+ <p>
28
+
29
+ What if a function doesn't use parameters at all, but
30
+ we pass them? Hmm...
31
+ <p>
32
+
33
+ Now we succeed and succeed some more
34
+ and finally we succeed in life.
35
+ <p>
36
+
37
+ But can we succeed, when our beds are burning?
@@ -0,0 +1,40 @@
1
+ Testing some more functions here...
2
+
3
+ .func just_do_it
4
+ item = param
5
+ # Do "something" with the parameter...
6
+ return "" # parameter disappears!
7
+ .end
8
+
9
+ Here I am calling a function $$just_do_it:foobar with
10
+ a colon parameter...
11
+
12
+
13
+ Next let's *do* something with our parameter:
14
+
15
+ .func reverse
16
+ param.reverse # just reverse it
17
+ .end
18
+
19
+ I'll call these variants...
20
+
21
+ "Motel" spelled backwards is $$reverse:motel :)
22
+
23
+ "lamina" reversed is $$reverse:lamina
24
+
25
+ I can also use the $$reverse[bracket feature] here.
26
+
27
+ If I don't use a parameter for $$reverse - it gives
28
+ me an error. (Bug or feature??)
29
+
30
+ What if a function doesn't use parameters at all, but
31
+ we pass them? Hmm...
32
+
33
+ .func meditate
34
+ "succeed" # just replaces params with this verb
35
+ .end
36
+
37
+ Now we $$meditate:slowly and $$meditate some more
38
+ and finally we $$meditate[on various things] in life.
39
+
40
+ But can we $$meditate, when our beds are burning?
@@ -4,4 +4,6 @@ testing a simple import
4
4
 
5
5
  Now call a method:
6
6
  Hello, world.
7
+ <p>
8
+
7
9
  That's all.
@@ -1,7 +1,9 @@
1
1
  Here I am
2
2
  testing a simple import
3
- .mixin simple_import
3
+
4
+ .import simple_import
4
5
 
5
6
  Now call a method:
6
7
  .hello_world
8
+
7
9
  That's all.
@@ -19,26 +19,21 @@
19
19
 
20
20
  # Note that QUIT (on a line by itself) will stop processing the file
21
21
 
22
- x error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
23
- x error_no_such_copy # ^ Same behavior as error_no_such_inc
24
- x error_no_such_mixin # ^ Same behavior as error_missing_end
25
- x error_invalid_name # ^ Same behavior as error_no_such_inc
26
- x error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
27
- x error_inc_line_num # Forgot what's wrong here
28
-
29
- # Dummy command .icanhaz works like .mixin or .import
30
-
31
- x icanhaz # "Leading" output doesn't get generated (same as error_no_such_inc)
32
- icanhaz2 # works?
33
22
 
34
23
  # Others (usually passing):
35
24
 
36
25
  # import/include/mixin, others...
37
26
 
27
+ x error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
28
+ x error_no_such_copy # ^ Same behavior as error_no_such_inc
29
+ x error_no_such_mixin # ^ Same behavior as error_missing_end
38
30
  simple_copy #
39
- x simple_import # not working yet (but *could* sub in .icanhaz)
31
+ simple_import #
40
32
  simple_include #
41
33
  simple_mixin #
34
+ x import # "Leading" output doesn't get generated (same as error_no_such_inc)
35
+ import2 #
36
+
42
37
 
43
38
  # raw input
44
39
 
@@ -72,10 +67,14 @@ x simple_import # not working yet (but *could* sub in .icanhaz)
72
67
  error_line_num #
73
68
  error_mismatched_end #
74
69
  error_name_not_permitted #
70
+ x error_invalid_name # ^ Same behavior as error_no_such_inc
71
+ x error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
72
+ x error_inc_line_num # Forgot what's wrong here
75
73
 
76
74
  # functions
77
75
 
78
76
  functions #
77
+ more_functions #
79
78
 
80
79
  # More/misc...
81
80
 
File without changes