livetext 0.9.23 → 0.9.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.lt3 +6 -6
- data/bin/livetext +57 -40
- data/imports/bookish.rb +81 -81
- data/imports/calibre.rb +3 -3
- data/imports/livemagick.rb +17 -17
- data/imports/markdown.rb +10 -10
- data/imports/pyggish.rb +13 -13
- data/imports/tutorial.rb +15 -15
- data/lib/cmdargs.rb +7 -4
- data/lib/{errors.rb → livetext/errors.rb} +4 -3
- data/lib/{formatline.rb → livetext/formatline.rb} +119 -18
- data/lib/livetext/funcall.rb +168 -0
- data/lib/{functions.rb → livetext/functions.rb} +0 -2
- data/lib/{global_helpers.rb → livetext/global_helpers.rb} +6 -3
- data/lib/{handler → livetext/handler}/import.rb +5 -9
- data/lib/livetext/handler/mixin.rb +33 -0
- data/lib/{handler.rb → livetext/handler.rb} +1 -1
- data/lib/{helpers.rb → livetext/helpers.rb} +78 -66
- data/lib/{html.rb → livetext/html.rb} +2 -3
- data/lib/livetext/lineparser.rb +441 -0
- data/lib/livetext/more.rb +158 -0
- data/lib/{parser → livetext/parser}/general.rb +0 -0
- data/lib/{parser → livetext/parser}/set.rb +0 -0
- data/lib/{parser → livetext/parser}/string.rb +0 -0
- data/lib/{parser.rb → livetext/parser.rb} +0 -3
- data/lib/{parsing.rb → livetext/parsing.rb} +0 -2
- data/lib/livetext/paths.rb +13 -0
- data/lib/{processor.rb → livetext/processor.rb} +18 -8
- data/lib/livetext/reopen.rb +12 -0
- data/lib/livetext/skeleton.rb +22 -0
- data/lib/{standard.rb → livetext/standard.rb} +150 -127
- data/lib/livetext/userapi.rb +170 -0
- data/lib/livetext/version.rb +6 -0
- data/lib/livetext.rb +14 -152
- data/plugin/bookish.rb +82 -81
- data/plugin/calibre.rb +3 -3
- data/plugin/livemagick.rb +17 -17
- data/plugin/markdown.rb +10 -10
- data/plugin/pyggish.rb +118 -118
- data/plugin/tutorial.rb +15 -15
- data/test/all.rb +6 -0
- data/test/snapshots/{error_inc_line_num → basic_formatting}/actual-error.txt +0 -0
- data/test/snapshots/basic_formatting/actual-output.txt +13 -0
- data/test/snapshots/basic_formatting/err-sdiff.txt +1 -0
- data/test/snapshots/basic_formatting/out-sdiff.txt +14 -0
- data/test/snapshots/def_method/expected-output.txt +2 -0
- data/test/snapshots/def_method/source.lt3 +4 -2
- data/test/snapshots/error_inc_line_num/{OUT → README.txt} +11 -8
- data/test/snapshots/error_inc_line_num/expected-output.txt +0 -6
- data/test/snapshots/error_inc_line_num/match-error.txt +1 -1
- data/test/snapshots/error_invalid_name/foo +5 -0
- data/test/snapshots/error_line_num/match-error.txt +1 -1
- data/test/snapshots/error_missing_end/expected-output.txt +0 -1
- data/test/snapshots/error_name_not_permitted/expected-output.txt +4 -0
- data/test/snapshots/error_name_not_permitted/match-error.txt +1 -1
- data/test/snapshots/error_no_such_copy/expected-output.txt +1 -0
- data/test/snapshots/error_no_such_mixin/expected-output.txt +1 -0
- data/test/snapshots/error_no_such_mixin/match-error.txt +1 -1
- data/test/snapshots/error_no_such_mixin/source.lt3 +1 -1
- data/test/snapshots/example_alpha/source.lt3 +2 -2
- data/test/snapshots/example_alpha2/expected-output.txt +0 -2
- data/test/snapshots/example_alpha2/source.lt3 +5 -4
- data/test/snapshots/import/expected-output.txt +2 -1
- data/test/snapshots/import/match-error.txt +1 -1
- data/test/snapshots/import/simple_import.rb +1 -1
- data/test/snapshots/import2/simple_import.rb +1 -1
- data/test/snapshots/import_bookish/expected-output.txt +4 -4
- data/test/snapshots/{error_invalid_name/actual-output.txt → more_functions/actual-error.txt} +0 -0
- data/test/snapshots/more_functions/actual-output.txt +37 -0
- data/test/snapshots/more_functions/err-sdiff.txt +1 -0
- data/test/snapshots/more_functions/expected-output.txt +1 -1
- data/test/snapshots/more_functions/out-sdiff.txt +38 -0
- data/test/snapshots/more_functions/source.lt3 +1 -1
- data/test/snapshots/raw_lines/expected-output.txt +0 -2
- data/test/snapshots/simple_import/simple_import.rb +1 -1
- data/test/snapshots/simple_mixin/simple_mixin.rb +1 -1
- data/test/snapshots/{error_missing_end/actual-output.txt → simple_vars/actual-error.txt} +0 -0
- data/test/snapshots/simple_vars/actual-output.txt +6 -0
- data/test/snapshots/simple_vars/err-sdiff.txt +1 -0
- data/test/snapshots/simple_vars/out-sdiff.txt +7 -0
- data/test/snapshots/single_raw_line/expected-output.txt +0 -2
- data/test/snapshots/subset.txt +9 -7
- data/test/snapshots/{error_no_such_copy/actual-output.txt → var_into_func/actual-error.txt} +0 -0
- data/test/snapshots/var_into_func/actual-output.txt +16 -0
- data/test/snapshots/var_into_func/err-sdiff.txt +1 -0
- data/test/snapshots/{error_no_such_inc/actual-output.txt → var_into_func/expected-error.txt} +0 -0
- data/test/snapshots/var_into_func/expected-output.txt +16 -0
- data/test/snapshots/var_into_func/out-sdiff.txt +17 -0
- data/test/snapshots/var_into_func/source.lt3 +16 -0
- data/test/snapshots.rb +16 -7
- data/test/unit/all.rb +3 -1
- data/test/unit/formatline.rb +145 -276
- data/test/unit/html.rb +1 -2
- data/test/unit/lineparser.rb +650 -0
- data/test/unit/parser/set.rb +13 -12
- data/test/unit/standard.rb +0 -1
- data/test/unit/tokenizer.rb +534 -0
- metadata +49 -39
- data/lib/funcall.rb +0 -93
- data/lib/parser/file.rb +0 -6
- data/lib/parser/mixin.rb +0 -34
- data/lib/userapi.rb +0 -164
- data/test/snapshots/error_inc_line_num/actual-output.txt +0 -17
- data/test/snapshots/error_invalid_name/actual-error.txt +0 -10
- data/test/snapshots/error_invalid_name/out-sdiff.txt +0 -6
- data/test/snapshots/error_missing_end/actual-error.txt +0 -10
- data/test/snapshots/error_missing_end/out-sdiff.txt +0 -6
- data/test/snapshots/error_no_such_copy/actual-error.txt +0 -10
- data/test/snapshots/error_no_such_copy/out-sdiff.txt +0 -5
- data/test/snapshots/error_no_such_inc/actual-error.txt +0 -10
- data/test/snapshots/error_no_such_inc/out-sdiff.txt +0 -6
- data/test/snapshots/error_no_such_mixin/actual-error.txt +0 -13
- data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
- 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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
93
|
+
def code # FIXME ?
|
94
|
+
text = ""
|
95
|
+
api.body {|line| api.out " " + line }
|
96
|
+
end
|
103
97
|
|
104
|
-
def
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
-
|
158
|
-
|
159
|
-
|
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
|
-
|
162
|
-
|
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
|
-
|
171
|
-
|
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
|
-
|
5
|
+
api.optional_blank_line
|
6
6
|
end
|
7
7
|
|
8
8
|
def section(args = nil, body = nil)
|
9
9
|
h3
|
10
|
-
|
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
|
-
|
15
|
+
api.body do |line|
|
16
16
|
tag, first = "<pre>", false if first
|
17
|
-
|
17
|
+
api.out "#{tag} #{::CGI.escape_html(line)}" # indentation
|
18
18
|
end
|
19
|
-
|
20
|
-
|
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 =
|
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
|
-
|
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
|
-
|
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
|
-
|
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 =
|
82
|
-
|
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
|
-
|
84
|
+
api.args = [src, exp] # Better way to do this??
|
85
85
|
put_table(src, exp)
|
86
|
-
|
87
|
-
|
86
|
+
api.out "<br>"
|
87
|
+
api.optional_blank_line
|
88
88
|
end
|
data/test/all.rb
CHANGED
File without changes
|
@@ -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: * _ `
|
@@ -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
|
-
|
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.
|
@@ -1 +1 @@
|
|
1
|
-
1 /
|
1
|
+
1 /Error: name 'foobar' is unknown/
|
@@ -1 +1 @@
|
|
1
|
-
1 /
|
1
|
+
1 /Error: name 'foobar' is unknown/
|
@@ -1 +1 @@
|
|
1
|
-
1 /
|
1
|
+
1 /name 'class' is invalid/
|
@@ -1 +1 @@
|
|
1
|
-
1 /
|
1
|
+
1 /file 'nosuchthing' not found/
|
@@ -1,15 +1,16 @@
|
|
1
1
|
.def alpha
|
2
|
-
cols =
|
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 =
|
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|
|
11
|
-
|
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 +1 @@
|
|
1
|
-
1 /
|
1
|
+
1 /file 'nonexistent' not found/
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<table cellpadding=2>
|
2
2
|
<tr>
|
3
|
-
<td width=
|
4
|
-
<td width=
|
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=
|
8
|
-
<td width=
|
7
|
+
<td width=0% valign=top>foo</td>
|
8
|
+
<td width=0% valign=top>bar</td>
|
9
9
|
</tr>
|
10
10
|
</table>
|
data/test/snapshots/{error_invalid_name/actual-output.txt → more_functions/actual-error.txt}
RENAMED
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 @@
|
|
1
|
+
ACTUAL | EXPECTED
|