livetext 0.9.23 → 0.9.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +6 -6
  3. data/bin/livetext +57 -40
  4. data/imports/bookish.rb +81 -81
  5. data/imports/calibre.rb +3 -3
  6. data/imports/livemagick.rb +17 -17
  7. data/imports/markdown.rb +10 -10
  8. data/imports/pyggish.rb +13 -13
  9. data/imports/tutorial.rb +15 -15
  10. data/lib/cmdargs.rb +7 -4
  11. data/lib/{errors.rb → livetext/errors.rb} +4 -3
  12. data/lib/{formatline.rb → livetext/formatline.rb} +119 -18
  13. data/lib/livetext/funcall.rb +168 -0
  14. data/lib/{functions.rb → livetext/functions.rb} +0 -2
  15. data/lib/{global_helpers.rb → livetext/global_helpers.rb} +6 -3
  16. data/lib/{handler → livetext/handler}/import.rb +5 -9
  17. data/lib/livetext/handler/mixin.rb +33 -0
  18. data/lib/{handler.rb → livetext/handler.rb} +1 -1
  19. data/lib/{helpers.rb → livetext/helpers.rb} +78 -66
  20. data/lib/{html.rb → livetext/html.rb} +2 -3
  21. data/lib/livetext/lineparser.rb +441 -0
  22. data/lib/livetext/more.rb +158 -0
  23. data/lib/{parser → livetext/parser}/general.rb +0 -0
  24. data/lib/{parser → livetext/parser}/set.rb +0 -0
  25. data/lib/{parser → livetext/parser}/string.rb +0 -0
  26. data/lib/{parser.rb → livetext/parser.rb} +0 -3
  27. data/lib/{parsing.rb → livetext/parsing.rb} +0 -2
  28. data/lib/livetext/paths.rb +13 -0
  29. data/lib/{processor.rb → livetext/processor.rb} +18 -8
  30. data/lib/livetext/reopen.rb +12 -0
  31. data/lib/livetext/skeleton.rb +22 -0
  32. data/lib/{standard.rb → livetext/standard.rb} +150 -127
  33. data/lib/livetext/userapi.rb +170 -0
  34. data/lib/livetext/version.rb +6 -0
  35. data/lib/livetext.rb +14 -152
  36. data/plugin/bookish.rb +82 -81
  37. data/plugin/calibre.rb +3 -3
  38. data/plugin/livemagick.rb +17 -17
  39. data/plugin/markdown.rb +10 -10
  40. data/plugin/pyggish.rb +118 -118
  41. data/plugin/tutorial.rb +15 -15
  42. data/test/all.rb +6 -0
  43. data/test/snapshots/{error_inc_line_num → basic_formatting}/actual-error.txt +0 -0
  44. data/test/snapshots/basic_formatting/actual-output.txt +13 -0
  45. data/test/snapshots/basic_formatting/err-sdiff.txt +1 -0
  46. data/test/snapshots/basic_formatting/out-sdiff.txt +14 -0
  47. data/test/snapshots/def_method/expected-output.txt +2 -0
  48. data/test/snapshots/def_method/source.lt3 +4 -2
  49. data/test/snapshots/error_inc_line_num/{OUT → README.txt} +11 -8
  50. data/test/snapshots/error_inc_line_num/expected-output.txt +0 -6
  51. data/test/snapshots/error_inc_line_num/match-error.txt +1 -1
  52. data/test/snapshots/error_invalid_name/foo +5 -0
  53. data/test/snapshots/error_line_num/match-error.txt +1 -1
  54. data/test/snapshots/error_missing_end/expected-output.txt +0 -1
  55. data/test/snapshots/error_name_not_permitted/expected-output.txt +4 -0
  56. data/test/snapshots/error_name_not_permitted/match-error.txt +1 -1
  57. data/test/snapshots/error_no_such_copy/expected-output.txt +1 -0
  58. data/test/snapshots/error_no_such_mixin/expected-output.txt +1 -0
  59. data/test/snapshots/error_no_such_mixin/match-error.txt +1 -1
  60. data/test/snapshots/error_no_such_mixin/source.lt3 +1 -1
  61. data/test/snapshots/example_alpha/source.lt3 +2 -2
  62. data/test/snapshots/example_alpha2/expected-output.txt +0 -2
  63. data/test/snapshots/example_alpha2/source.lt3 +5 -4
  64. data/test/snapshots/import/expected-output.txt +2 -1
  65. data/test/snapshots/import/match-error.txt +1 -1
  66. data/test/snapshots/import/simple_import.rb +1 -1
  67. data/test/snapshots/import2/simple_import.rb +1 -1
  68. data/test/snapshots/import_bookish/expected-output.txt +4 -4
  69. data/test/snapshots/{error_invalid_name/actual-output.txt → more_functions/actual-error.txt} +0 -0
  70. data/test/snapshots/more_functions/actual-output.txt +37 -0
  71. data/test/snapshots/more_functions/err-sdiff.txt +1 -0
  72. data/test/snapshots/more_functions/expected-output.txt +1 -1
  73. data/test/snapshots/more_functions/out-sdiff.txt +38 -0
  74. data/test/snapshots/more_functions/source.lt3 +1 -1
  75. data/test/snapshots/raw_lines/expected-output.txt +0 -2
  76. data/test/snapshots/simple_import/simple_import.rb +1 -1
  77. data/test/snapshots/simple_mixin/simple_mixin.rb +1 -1
  78. data/test/snapshots/{error_missing_end/actual-output.txt → simple_vars/actual-error.txt} +0 -0
  79. data/test/snapshots/simple_vars/actual-output.txt +6 -0
  80. data/test/snapshots/simple_vars/err-sdiff.txt +1 -0
  81. data/test/snapshots/simple_vars/out-sdiff.txt +7 -0
  82. data/test/snapshots/single_raw_line/expected-output.txt +0 -2
  83. data/test/snapshots/subset.txt +9 -7
  84. data/test/snapshots/{error_no_such_copy/actual-output.txt → var_into_func/actual-error.txt} +0 -0
  85. data/test/snapshots/var_into_func/actual-output.txt +16 -0
  86. data/test/snapshots/var_into_func/err-sdiff.txt +1 -0
  87. data/test/snapshots/{error_no_such_inc/actual-output.txt → var_into_func/expected-error.txt} +0 -0
  88. data/test/snapshots/var_into_func/expected-output.txt +16 -0
  89. data/test/snapshots/var_into_func/out-sdiff.txt +17 -0
  90. data/test/snapshots/var_into_func/source.lt3 +16 -0
  91. data/test/snapshots.rb +16 -7
  92. data/test/unit/all.rb +3 -1
  93. data/test/unit/formatline.rb +145 -276
  94. data/test/unit/html.rb +1 -2
  95. data/test/unit/lineparser.rb +650 -0
  96. data/test/unit/parser/set.rb +13 -12
  97. data/test/unit/standard.rb +0 -1
  98. data/test/unit/tokenizer.rb +534 -0
  99. metadata +49 -39
  100. data/lib/funcall.rb +0 -93
  101. data/lib/parser/file.rb +0 -6
  102. data/lib/parser/mixin.rb +0 -34
  103. data/lib/userapi.rb +0 -164
  104. data/test/snapshots/error_inc_line_num/actual-output.txt +0 -17
  105. data/test/snapshots/error_invalid_name/actual-error.txt +0 -10
  106. data/test/snapshots/error_invalid_name/out-sdiff.txt +0 -6
  107. data/test/snapshots/error_missing_end/actual-error.txt +0 -10
  108. data/test/snapshots/error_missing_end/out-sdiff.txt +0 -6
  109. data/test/snapshots/error_no_such_copy/actual-error.txt +0 -10
  110. data/test/snapshots/error_no_such_copy/out-sdiff.txt +0 -5
  111. data/test/snapshots/error_no_such_inc/actual-error.txt +0 -10
  112. data/test/snapshots/error_no_such_inc/out-sdiff.txt +0 -6
  113. data/test/snapshots/error_no_such_mixin/actual-error.txt +0 -13
  114. data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
  115. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +0 -6
data/plugin/pyggish.rb CHANGED
@@ -34,139 +34,139 @@ def self.pyg_finalize(code, lexer=:elixir)
34
34
  code.sub!(/<pre>/, "<pre>\n")
35
35
  code.gsub!(/<span class="[np]">/, "")
36
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
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
52
52
 
53
- def _process_code(text)
54
- lines = text.split("\n")
55
- lines = lines.select {|x| x !~ /##~ omit/ }
56
- @refs = {}
57
- lines.each.with_index do |line, i|
58
- if line =~ /##~ ref/
59
- frag, name = line.split(/ *##~ ref/)
60
- @refs[name.strip] = i
61
- line.replace(frag)
53
+ def _process_code(text)
54
+ lines = text.split("\n")
55
+ lines = lines.select {|x| x !~ /##~ omit/ }
56
+ @refs = {}
57
+ lines.each.with_index do |line, i|
58
+ if line =~ /##~ ref/
59
+ frag, name = line.split(/ *##~ ref/)
60
+ @refs[name.strip] = i
61
+ line.replace(frag)
62
+ end
62
63
  end
64
+ lines.map! {|line| " " + line }
65
+ text2 = lines.join("\n")
66
+ text.replace(text2)
63
67
  end
64
- lines.map! {|line| " " + line }
65
- text2 = lines.join("\n")
66
- text.replace(text2)
67
- end
68
68
 
69
- def _colorize(code, lexer=:elixir)
70
- text = ::Pygments.highlight(code, lexer: lexer, options: {linenos: "table"})
71
- _debug "--- in _colorize: text = #{text.inspect}"
72
- text2 = PygmentFix.pyg_finalize(text, lexer)
73
- result = "<!-- colorized code -->\n" + text2
74
- result
75
- end
76
-
77
- def _colorize!(code, lexer=:elixir)
78
- text = ::Pygments.highlight(code, lexer: lexer, options: {})
79
- _debug "--- in _colorize!: text = #{text.inspect}"
80
- text2 = PygmentFix.pyg_finalize(text, lexer)
81
- result = "<!-- colorized code -->\n" + text2
82
- result
83
- end
69
+ def _colorize(code, lexer=:elixir)
70
+ text = ::Pygments.highlight(code, lexer: lexer, options: {linenos: "table"})
71
+ _debug "--- in _colorize: text = #{text.inspect}"
72
+ text2 = PygmentFix.pyg_finalize(text, lexer)
73
+ result = "<!-- colorized code -->\n" + text2
74
+ result
75
+ end
84
76
 
85
- def fragment
86
- lang = @_args.empty? ? :elixir : @_args.first.to_sym # ruby or elixir
87
- @_args = []
88
- # TTY.puts "\n#{self.inspect}"
89
- send(lang)
90
- _out "\n"
91
- end
77
+ def _colorize!(code, lexer=:elixir)
78
+ text = ::Pygments.highlight(code, lexer: lexer, options: {})
79
+ _debug "--- in _colorize!: text = #{text.inspect}"
80
+ text2 = PygmentFix.pyg_finalize(text, lexer)
81
+ result = "<!-- colorized code -->\n" + text2
82
+ result
83
+ end
92
84
 
93
- def code # FIXME ?
94
- text = ""
95
- _body {|line| _out " " + line }
96
- end
85
+ def fragment
86
+ lang = api.args.empty? ? :elixir : api.args.first.to_sym # ruby or elixir
87
+ api.args = []
88
+ # TTY.puts "\n#{self.inspect}"
89
+ send(lang)
90
+ api.out "\n"
91
+ end
97
92
 
98
- def mono
99
- _out "<pre>"
100
- _body {|line| _out " " + line }
101
- _out "</pre>"
102
- end
93
+ def code # FIXME ?
94
+ text = ""
95
+ api.body {|line| api.out " " + line }
96
+ end
103
97
 
104
- def create_code_styles
105
- dir = @_outdir || "."
106
- theme, back = "Github", "white"
107
- css = Rouge::Themes.const_get(theme).render(scope: '.rb_highlight')
108
- added = <<~CSS
109
- .rb_highlight {
110
- font-family: 'Monaco', 'Andale Mono', 'Lucida Grande', 'Courier', 'Lucida Console', 'Courier New', monospace;
111
- white-space: pre;
112
- background-color: #{back}
113
- }
114
- CSS
115
-
116
- css.gsub!(/{\n/, "{\n font-family: courier;")
117
- css = added + "\n" + css
118
- # STDERR.puts "Writing #{theme} theme to ruby.css"
119
- File.write("#{dir}/ruby.css", css)
120
-
121
- css = Rouge::Themes.const_get(theme).render(scope: '.ex_highlight')
122
- added = added.sub(/rb/, "ex")
123
- css.gsub!(/{\n/, "{\n font-family: courier;")
124
- css = added + "\n" + css
125
- # STDERR.puts "Writing #{theme} theme to elixir.css"
126
- File.write("#{dir}/elixir.css", css)
127
- end
98
+ def mono
99
+ api.out "<pre>"
100
+ api.body {|line| api.out " " + line }
101
+ api.out "</pre>"
102
+ end
128
103
 
104
+ def create_code_styles
105
+ dir = @_outdir || "."
106
+ theme, back = "Github", "white"
107
+ css = Rouge::Themes.const_get(theme).render(scope: '.rb_highlight')
108
+ added = <<~CSS
109
+ .rb_highlight {
110
+ font-family: 'Monaco', 'Andale Mono', 'Lucida Grande', 'Courier', 'Lucida Console', 'Courier New', monospace;
111
+ white-space: pre;
112
+ background-color: #{back}
113
+ }
114
+ CSS
115
+
116
+ css.gsub!(/{\n/, "{\n font-family: courier;")
117
+ css = added + "\n" + css
118
+ # STDERR.puts "Writing #{theme} theme to ruby.css"
119
+ File.write("#{dir}/ruby.css", css)
120
+
121
+ css = Rouge::Themes.const_get(theme).render(scope: '.ex_highlight')
122
+ added = added.sub(/rb/, "ex")
123
+ css.gsub!(/{\n/, "{\n font-family: courier;")
124
+ css = added + "\n" + css
125
+ # STDERR.puts "Writing #{theme} theme to elixir.css"
126
+ File.write("#{dir}/elixir.css", css)
127
+ end
129
128
 
130
- def format_ruby(source, theme = "Github", back = "black")
131
- # theme/back not used now
132
- formatter = Rouge::Formatters::HTML.new
133
- lexer = Rouge::Lexers::Ruby.new
134
- body = formatter.format(lexer.lex(source))
135
- text = "<div class=rb_highlight>#{body}</div>"
136
- text
137
- end
138
129
 
139
- def format_elixir(source, theme = "Github", back = "black")
140
- # theme/back not used now
141
- formatter = Rouge::Formatters::HTML.new
142
- lexer = Rouge::Lexers::Elixir.new
143
- body = formatter.format(lexer.lex(source))
144
- text = "<div class=ex_highlight>#{body}</div>"
145
- text
146
- end
130
+ def format_ruby(source, theme = "Github", back = "black")
131
+ # theme/back not used now
132
+ formatter = Rouge::Formatters::HTML.new
133
+ lexer = Rouge::Lexers::Ruby.new
134
+ body = formatter.format(lexer.lex(source))
135
+ text = "<div class=rb_highlight>#{body}</div>"
136
+ text
137
+ end
147
138
 
148
- def ruby
149
- file = @_args.first
150
- if file.nil?
151
- code = " # Ruby code\n\n"
152
- _body {|line| code << " " + line + "\n" }
153
- else
154
- code = "# Ruby code\n\n" + ::File.read(file)
139
+ def format_elixir(source, theme = "Github", back = "black")
140
+ # theme/back not used now
141
+ formatter = Rouge::Formatters::HTML.new
142
+ lexer = Rouge::Lexers::Elixir.new
143
+ body = formatter.format(lexer.lex(source))
144
+ text = "<div class=ex_highlight>#{body}</div>"
145
+ text
155
146
  end
156
147
 
157
- html = format_ruby(code)
158
- _out html
159
- end
148
+ def ruby
149
+ file = api.args.first
150
+ if file.nil?
151
+ code = " # Ruby code\n\n"
152
+ api.body {|line| code << " " + line + "\n" }
153
+ else
154
+ code = "# Ruby code\n\n" + ::File.read(file)
155
+ end
160
156
 
161
- def elixir
162
- file = @_args.first
163
- if file.nil?
164
- code = ""
165
- _body {|line| code << " " + line + "\n" }
166
- else
167
- code = ::File.read(file)
157
+ html = format_ruby(code)
158
+ api.out html
168
159
  end
169
160
 
170
- html = format_elixir(code)
171
- _out html
161
+ def elixir
162
+ file = api.args.first
163
+ if file.nil?
164
+ code = ""
165
+ api.body {|line| code << " " + line + "\n" }
166
+ else
167
+ code = ::File.read(file)
168
+ end
169
+
170
+ html = format_elixir(code)
171
+ api.out html
172
172
  end
data/plugin/tutorial.rb CHANGED
@@ -2,22 +2,22 @@ require 'cgi'
2
2
 
3
3
  def title(args = nil, body = nil)
4
4
  h1
5
- _optional_blank_line
5
+ api.optional_blank_line
6
6
  end
7
7
 
8
8
  def section(args = nil, body = nil)
9
9
  h3
10
- _optional_blank_line
10
+ api.optional_blank_line
11
11
  end
12
12
 
13
13
  def code(args = nil, body = nil)
14
14
  first = true # dumb hack! fixes blank space
15
- _body do |line|
15
+ api.body do |line|
16
16
  tag, first = "<pre>", false if first
17
- _out "#{tag} #{::CGI.escape_html(line)}" # indentation
17
+ api.out "#{tag} #{::CGI.escape_html(line)}" # indentation
18
18
  end
19
- _out "</pre>"
20
- _optional_blank_line
19
+ api.out "</pre>"
20
+ api.optional_blank_line
21
21
  end
22
22
 
23
23
  def rx(str)
@@ -25,14 +25,14 @@ def rx(str)
25
25
  end
26
26
 
27
27
  def inout(args = nil, body = nil)
28
- src, out = _args
28
+ src, out = api.args
29
29
  t1 = ::File.readlines(src) rescue (abort "t1 = #{src}")
30
30
  t2 = ::File.readlines(out) rescue (abort "t2 = #{out}")
31
31
  # To pacify markdown for README (FIXME later)
32
32
  t1 = t1.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
33
33
  t2 = t2.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
34
34
 
35
- _out <<-HTML
35
+ api.out <<-HTML
36
36
  <table width=80% cellpadding=4>
37
37
  <tr>
38
38
  <td width=50%><b>Input</b></td>
@@ -48,7 +48,7 @@ def inout(args = nil, body = nil)
48
48
  </tr>
49
49
  </table>
50
50
  HTML
51
- _optional_blank_line
51
+ api.optional_blank_line
52
52
  end
53
53
 
54
54
  def put_table(src, exp)
@@ -57,7 +57,7 @@ def put_table(src, exp)
57
57
  t1 = t1.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
58
58
  t2 = t2.map {|x| " " + x.sub(/ +$/,"").gsub(/_/, "\\_") }.join
59
59
 
60
- _out <<-HTML
60
+ api.out <<-HTML
61
61
  <font size=+1>
62
62
  <table width=80% cellpadding=4>
63
63
  <tr>
@@ -78,11 +78,11 @@ def put_table(src, exp)
78
78
  end
79
79
 
80
80
  def testcase(args = nil, body = nil)
81
- name = _args.first
82
- _out "\n<font size=+1><b>Test: </font><font size=+2><tt>#{name}</tt></font></b></h3><br>"
81
+ name = api.args.first
82
+ api.out "\n<font size=+1><b>Test: </font><font size=+2><tt>#{name}</tt></font></b></h3><br>"
83
83
  src, exp = "test/snapshots/#{name}/source.lt3", "test/snapshots/#{name}/expected-output.txt"
84
- @_args = [src, exp] # Better way to do this??
84
+ api.args = [src, exp] # Better way to do this??
85
85
  put_table(src, exp)
86
- _out "<br>"
87
- _optional_blank_line
86
+ api.out "<br>"
87
+ api.optional_blank_line
88
88
  end
data/test/all.rb CHANGED
@@ -1,3 +1,9 @@
1
+ require 'simplecov' # These two lines must go first
2
+ SimpleCov.start do
3
+ puts "SimpleCov: Snapshots"
4
+ enable_coverage :branch
5
+ add_filter "/test/"
6
+ end
1
7
 
2
8
  require_relative 'unit/all'
3
9
  require_relative 'snapshots' # snapshots
@@ -0,0 +1,13 @@
1
+ Here are examples of <b>boldface</b>
2
+ and <i>italics</i>
3
+ and <font size=+1><tt>code</tt></font>
4
+ as well as <b>ore complex</b>*examples
5
+ of <i>talicized text</i>
6
+ and <font size=+1><tt>ode font</tt></font>
7
+ <p>
8
+
9
+ Here are some random punctuation marks:
10
+ ; # . * * ` ` @ % ^ & $
11
+ <p>
12
+
13
+ No need to escape these: * * `
@@ -0,0 +1 @@
1
+ ACTUAL | EXPECTED
@@ -0,0 +1,14 @@
1
+ ACTUAL | EXPECTED
2
+ Here are examples of <b>boldface</b> | Here are examples of <b>boldface</b>
3
+ and <i>italics</i> and <i>italics</i>
4
+ and <font size=+1><tt>code</tt></font> and <font size=+1><tt>code</tt></font>
5
+ as well as <b>ore complex</b>*examples | as well as <b>more complex</b> examples
6
+ of <i>talicized text</i> | of <i>italicized text</i>
7
+ and <font size=+1><tt>ode font</tt></font> | and <font size=+1><tt>code font</tt></font>.
8
+ <p> <p>
9
+
10
+ Here are some random punctuation marks: Here are some random punctuation marks:
11
+ ; # . * * ` ` @ % ^ & $ | ; # . * _ ` : @ % ^ & $
12
+ <p> <p>
13
+
14
+ No need to escape these: * * ` | No need to escape these: * _ `
@@ -1,5 +1,7 @@
1
1
  abc
2
2
  123
3
3
  xyz
4
+ <p>
5
+
4
6
  xyzzy
5
7
  123
@@ -2,10 +2,12 @@
2
2
  abc
3
3
  123
4
4
  .def foobar # yet another experimental comment
5
- ::STDERR.puts "This is the"
6
- ::STDERR.puts "foobar method"
5
+ ::STDERR.puts "This is the"
6
+ ::STDERR.puts "foobar method"
7
+ true
7
8
  .end
8
9
  xyz
9
10
  .foobar # and still another
11
+
10
12
  xyzzy
11
13
  123
@@ -1,17 +1,20 @@
1
+ ---- File: source.lt3
2
+
1
3
  This is my
2
4
  source file
3
5
  which includes file2 here:
6
+ .include file2.lt3
7
+
8
+ And here we are
9
+ back in the
10
+ original file.
11
+
12
+ --- File: file2.lt3
13
+
4
14
  This is file2
5
15
  which has an error
6
16
  about an unknown command
7
17
  in line 5
8
- This is my
9
- source file
10
- which includes file2 here:
11
- This is file2
12
- which has an error
13
- about an unknown command
14
- in line 5
15
- <p>
18
+ .foobar
16
19
 
17
20
  And this is file2 line 7.
@@ -5,9 +5,3 @@ which includes file2 here:
5
5
  which has an error
6
6
  about an unknown command
7
7
  in line 5
8
- <p>
9
-
10
- And this is file2 line 7.
11
- And here we are
12
- back in the
13
- original file.
@@ -1 +1 @@
1
- 1 /Name 'foobar' is unknown/
1
+ 1 /Error: name 'foobar' is unknown/
@@ -0,0 +1,5 @@
1
+ T
2
+ a
3
+ t
4
+ <p>
5
+
@@ -1 +1 @@
1
- 1 /Name 'foobar' is unknown/
1
+ 1 /Error: name 'foobar' is unknown/
@@ -2,4 +2,3 @@ Blah
2
2
  blah
3
3
  <p>
4
4
 
5
-
@@ -0,0 +1,4 @@
1
+ Names such as 'class'
2
+ are not permitted here...
3
+ <p>
4
+
@@ -1 +1 @@
1
- 1 /Disallowed/
1
+ 1 /name 'class' is invalid/
@@ -2,3 +2,4 @@ Make sure a
2
2
  nonexistent file with .copy
3
3
  gives an error.
4
4
  <p>
5
+
@@ -3,3 +3,4 @@ we give an error
3
3
  when a mixin does not
4
4
  exist:
5
5
  <p>
6
+
@@ -1 +1 @@
1
- 1 /No such mixin 'nosuchthing'/
1
+ 1 /file 'nosuchthing' not found/
@@ -1,4 +1,4 @@
1
- Test that
1
+ Test that
2
2
  we give an error
3
3
  when a mixin does not
4
4
  exist:
@@ -1,7 +1,7 @@
1
1
  .def alpha
2
- text = _body.to_a.join(" ")
2
+ text = api.body.to_a.join(" ")
3
3
  words = text.split.sort
4
- words.each {|w| _out " #{w}" }
4
+ words.each {|w| api.out " #{w}" }
5
5
  .end
6
6
  Here is an alphabetized list:
7
7
 
@@ -7,6 +7,4 @@ fishmonger fusillade glyph
7
7
  gryphon halcyon manicotti
8
8
  mataeotechny pareidolia quark
9
9
  zootrope zymurgy
10
- <p>
11
-
12
10
  And that is all.
@@ -1,15 +1,16 @@
1
1
  .def alpha
2
- cols = _args.first
2
+ cols = api.args.first
3
3
  cols = "1" if cols == ""
4
4
  cols = cols.to_i
5
5
  raise "Columns must be 1-5" unless cols.between?(1,5)
6
- text = _body.join("\n")
6
+ text = api.body.join("\n")
7
7
  text.gsub!(/\n/, " ")
8
8
  words = text.split.sort
9
9
  words.each_slice(cols) do |row|
10
- row.each {|w| _out! '%-15s' % w }
11
- _out
10
+ row.each {|w| api.out! '%-15s' % w }
11
+ api.out
12
12
  end
13
+ api.optional_blank_line
13
14
  .end
14
15
  Here is an alphabetized list:
15
16
 
@@ -1,5 +1,6 @@
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
  <p>
6
+
@@ -1 +1 @@
1
- 1 /No such mixin 'nonexistent'/
1
+ 1 /file 'nonexistent' not found/
@@ -1,5 +1,5 @@
1
1
  module SimpleImport
2
2
  def hello_world
3
- _out "Hello, world."
3
+ api.out "Hello, world."
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module SimpleImport
2
2
  def hello_world
3
- _out "Hello, world."
3
+ api.out "Hello, world."
4
4
  end
5
5
  end
@@ -1,10 +1,10 @@
1
1
  <table cellpadding=2>
2
2
  <tr>
3
- <td width=[0, 0]% valign=top>this</td>
4
- <td width=[0, 0]% valign=top>that</td>
3
+ <td width=0% valign=top>this</td>
4
+ <td width=0% valign=top>that</td>
5
5
  </tr>
6
6
  <tr>
7
- <td width=[0, 0]% valign=top>foo</td>
8
- <td width=[0, 0]% valign=top>bar</td>
7
+ <td width=0% valign=top>foo</td>
8
+ <td width=0% valign=top>bar</td>
9
9
  </tr>
10
10
  </table>
@@ -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 @@
1
+ ACTUAL | EXPECTED
@@ -7,7 +7,7 @@ a colon parameter...
7
7
 
8
8
  <p>
9
9
 
10
- Next let's <b>do*</b> something with our parameter:
10
+ Next let's <b>do</b> something with our parameter:
11
11
  <p>
12
12
 
13
13
  I'll call these variants...