livetext 0.8.77 → 0.8.78
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/SAVE.formatline +297 -0
- data/lib/SAVE2.formatline.rb +707 -0
- data/lib/formatline.rb +282 -257
- data/lib/livetext.rb +4 -3
- data/lib/processor.rb +1 -1
- data/lib/standard.rb +5 -2
- data/lib/userapi.rb +8 -5
- data/test/data/SAVE.lines +284 -0
- data/test/data/basic_formatting/expected-output.txt +1 -1
- data/test/data/error_invalid_name/expected-output.txt +0 -1
- data/test/data/error_missing_end/expected-output.txt +0 -1
- data/test/data/example_alpha/expected-output.txt +3 -3
- data/test/data/example_alpha/source.lt3 +1 -1
- data/test/data/example_alpha2/expected-output.txt +3 -3
- data/test/data/example_alpha2/source.lt3 +2 -2
- data/test/data/lines.txt +6 -190
- data/test/data/simple_mixin/expected-output.txt +3 -0
- data/test/data/simple_mixin/simple_mixin.rb +1 -1
- data/test/data/simple_mixin/source.lt3 +1 -1
- data/test/data/subset.txt +0 -0
- data/test/test.rb +31 -14
- metadata +6 -2
@@ -1,12 +1,12 @@
|
|
1
|
+
Here is an alphabetized list:
|
2
|
+
<p>
|
3
|
+
|
1
4
|
aardvark anamorphic anarchist
|
2
5
|
bellicose cytology ectomorph
|
3
6
|
fishmonger fusillade glyph
|
4
7
|
gryphon halcyon manicotti
|
5
8
|
mataeotechny pareidolia quark
|
6
9
|
zootrope zymurgy
|
7
|
-
Here is an alphabetized list:
|
8
|
-
<p>
|
9
|
-
|
10
10
|
<p>
|
11
11
|
|
12
12
|
And that is all.
|
data/test/data/lines.txt
CHANGED
@@ -1,186 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
tick: Single token, middle of line
|
6
|
-
They say `def is like a reserved word
|
7
|
-
They say <font size=+1><tt>def</tt></font> is like a reserved word
|
8
|
-
|
9
|
-
tick: Single token, end of line
|
10
|
-
like a reserved word, is `def
|
11
|
-
like a reserved word, is <font size=+1><tt>def</tt></font>
|
12
|
-
|
13
|
-
tick: Bracketed, normal
|
14
|
-
This is `[code font] here
|
15
|
-
This is <font size=+1><tt>code font</tt></font> here
|
16
|
-
|
17
|
-
tick: Bracketed, hits EOL
|
18
|
-
This is `[code font here
|
19
|
-
This is <font size=+1><tt>code font here</tt></font>
|
20
|
-
|
21
|
-
tick: followed by space
|
22
|
-
This is not ` code
|
23
|
-
This is not ` code
|
24
|
-
|
25
|
-
tick: followed by EOL
|
26
|
-
This also isn't code: `
|
27
|
-
This also isn't code: `
|
28
|
-
|
29
|
-
tick: Doubled, ignores comma
|
30
|
-
This is ``code, of course
|
31
|
-
This is <font size=+1><tt>code</tt></font>, of course
|
32
|
-
|
33
|
-
tick: Doubled, ignores period
|
34
|
-
This is ``code. Hooray, I guess.
|
35
|
-
This is <font size=+1><tt>code</tt></font>. Hooray, I guess.
|
36
|
-
|
37
|
-
tick: Doubled, ignores right paren
|
38
|
-
(By the way, this is ``code)
|
39
|
-
(By the way, this is <font size=+1><tt>code</tt></font>)
|
40
|
-
|
41
|
-
tick: Doubled, ignores EOL
|
42
|
-
Up to EOL, this is ``code
|
43
|
-
Up to EOL, this is <font size=+1><tt>code</tt></font>
|
44
|
-
|
45
|
-
uscore: Single token, beginning of line
|
46
|
-
_This is italics
|
47
|
-
<i>This</i> is italics
|
48
|
-
|
49
|
-
uscore: Single token, middle of line
|
50
|
-
And _this is italics
|
51
|
-
And <i>this</i> is italics
|
52
|
-
|
53
|
-
uscore: Single token, end of line
|
54
|
-
And so is _this
|
55
|
-
And so is <i>this</i>
|
56
|
-
|
57
|
-
uscore: Bracketed, normal
|
58
|
-
The _[USS Enterprise] was here
|
59
|
-
The <i>USS Enterprise</i> was here
|
60
|
-
|
61
|
-
uscore: Bracketed, hits EOL
|
62
|
-
Hey, it's the _[USS Enterprise
|
63
|
-
Hey, it's the <i>USS Enterprise</i>
|
64
|
-
|
65
|
-
uscore: followed by space
|
66
|
-
This: _ is just an underscore
|
67
|
-
This: _ is just an underscore
|
68
|
-
|
69
|
-
uscore: followed by EOL
|
70
|
-
This is just an underscore: _
|
71
|
-
This is just an underscore: _
|
72
|
-
|
73
|
-
uscore: Doubled, ignores comma
|
74
|
-
Just a __second, ok?
|
75
|
-
Just a <i>second</i>, ok?
|
76
|
-
|
77
|
-
uscore: Doubled, ignores period
|
78
|
-
Just a __second. OK?
|
79
|
-
Just a <i>second</i>. OK?
|
80
|
-
|
81
|
-
uscore: Doubled, ignores right paren
|
82
|
-
I'll (just a __second) be right there.
|
83
|
-
I'll (just a <i>second</i>) be right there.
|
84
|
-
|
85
|
-
uscore: Doubled, ignores EOL
|
86
|
-
Be there in a __second
|
87
|
-
Be there in a <i>second</i>
|
88
|
-
|
89
|
-
Tick has precedence over underscore
|
90
|
-
This is a `piece_of_code here
|
91
|
-
This is a <font size=+1><tt>piece_of_code</tt></font> here
|
92
|
-
|
93
|
-
under: Starts after double quote?
|
94
|
-
He said, "_Please go away."
|
95
|
-
He said, "<i>Please</i> go away."
|
96
|
-
|
97
|
-
Dollar sign followed by blank
|
98
|
-
This: $ is a dollar sign
|
99
|
-
This: $ is a dollar sign
|
100
|
-
|
101
|
-
Dollar sign followed by non-alpha
|
102
|
-
I'd pay $3 for that
|
103
|
-
I'd pay $3 for that
|
104
|
-
|
105
|
-
Dollar sign followed by EOL
|
106
|
-
This is a dollar sign: $
|
107
|
-
This is a dollar sign: $
|
108
|
-
|
109
|
-
Double dollar sign followed by blank
|
110
|
-
This: $$ is not a function call
|
111
|
-
This: $$ is not a function call
|
112
|
-
|
113
|
-
Double dollar sign followed by non-alpha
|
114
|
-
If I say $$-, that's not a function call
|
115
|
-
If I say $$-, that's not a function call
|
116
|
-
|
117
|
-
Double dollar sign followed by EOL
|
118
|
-
This is two dollar signs: $$
|
119
|
-
This is two dollar signs: $$
|
120
|
-
|
121
|
-
Escaped *
|
122
|
-
Asterisk followed by abc: \*abc
|
123
|
-
Asterisk followed by abc: *abc
|
124
|
-
|
125
|
-
Escaped _
|
126
|
-
Underscore followed by abc: \_abc
|
127
|
-
Underscore followed by abc: _abc
|
128
|
-
|
129
|
-
Escaped `
|
130
|
-
Tick followed by abc: \`abc
|
131
|
-
Tick followed by abc: `abc
|
132
|
-
|
133
|
-
Escaped $
|
134
|
-
This: \$var is not a variable
|
135
|
-
This: $var is not a variable
|
136
|
-
|
137
|
-
Escaped $$
|
138
|
-
This: \$\$func is not a function
|
139
|
-
This: $$func is not a function
|
140
|
-
|
141
|
-
strike: Single token, beginning of line
|
142
|
-
~this - no, I mean that
|
143
|
-
<strike>this</strike> - no, I mean that
|
144
|
-
|
145
|
-
strike: Single token, middle of line
|
146
|
-
They say ~redacted is fun
|
147
|
-
They say <strike>redacted</strike> is fun
|
148
|
-
|
149
|
-
strike: Single token, end of line
|
150
|
-
Ignore this: ~foobar
|
151
|
-
Ignore this: <strike>foobar</strike>
|
152
|
-
|
153
|
-
strike: Bracketed, normal
|
154
|
-
This is ~[crossed out] text
|
155
|
-
This is <strike>crossed out</strike> text
|
156
|
-
|
157
|
-
strike: Bracketed, hits EOL
|
158
|
-
This is ~[more stuff crossed out
|
159
|
-
This is <strike>more stuff crossed out</strike>
|
160
|
-
|
161
|
-
strike: followed by space
|
162
|
-
This is not ~ overstrike
|
163
|
-
This is not ~ overstrike
|
164
|
-
|
165
|
-
strike: followed by EOL
|
166
|
-
This also isn't overstrike: `
|
167
|
-
This also isn't overstrike: `
|
168
|
-
|
169
|
-
strike: Doubled, ignores comma
|
170
|
-
This is ~~overstrike, of course
|
171
|
-
This is <strike>overstrike</strike>, of course
|
172
|
-
|
173
|
-
strike: Doubled, ignores period
|
174
|
-
This is ~~overstrike. Hooray, I guess.
|
175
|
-
This is <strike>overstrike</strike>. Hooray, I guess.
|
176
|
-
|
177
|
-
strike: Doubled, ignores right paren
|
178
|
-
(By the way, this is ~~overstrike)
|
179
|
-
(By the way, this is <strike>overstrike</strike>)
|
1
|
+
Check output of $$date
|
2
|
+
Today is $$date, I guess
|
3
|
+
/Today is \d\d\d\d-\d\d-\d\d, I guess/
|
180
4
|
|
181
|
-
|
182
|
-
|
183
|
-
|
5
|
+
Check output of $$time
|
6
|
+
Tick tock, it's $$time right now
|
7
|
+
/Tick tock, it's \d\d:\d\d:\d\d right now/
|
184
8
|
|
185
9
|
Trying $$b function, no param
|
186
10
|
This is $$b being called
|
@@ -274,11 +98,3 @@ Escape brackets inside ~
|
|
274
98
|
There are brackets ~[\[\]] here
|
275
99
|
There are brackets <strike>[]</strike> here
|
276
100
|
|
277
|
-
Check output of $$date
|
278
|
-
Today is $$date, I guess
|
279
|
-
/Today is \d\d\d\d-\d\d-\d\d, I guess/
|
280
|
-
|
281
|
-
Check output of $$time
|
282
|
-
Tick tock, it's $$time right now
|
283
|
-
/Tick tock, it's \d\d:\d\d:\d\d right now/
|
284
|
-
|
File without changes
|
data/test/test.rb
CHANGED
@@ -31,28 +31,42 @@ class TestingLivetext < MiniTest::Test
|
|
31
31
|
break if f.eof?
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
if File.size("subset.txt") # == 0
|
35
|
+
puts "Defining via TestLines"
|
36
|
+
TestLines.each.with_index do |item, i|
|
37
|
+
msg, src, exp, blank = *item
|
38
|
+
define_method("test_formatting_#{i}") do
|
39
|
+
actual = FormatLine.parse!(src)
|
40
|
+
if exp[0] == "/" # regex!
|
41
|
+
exp = Regexp.compile(exp[1..-2]) # skip slashes
|
42
|
+
assert_match(exp, actual, msg)
|
43
|
+
else
|
44
|
+
assert_equal(exp, actual, msg)
|
45
|
+
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
50
|
TestDirs = Dir.entries(".").reject {|f| ! File.directory?(f) } - %w[. ..]
|
51
|
+
selected = File.readlines("subset.txt").map(&:chomp)
|
52
|
+
Subset = selected.empty? ? TestDirs : selected
|
49
53
|
|
50
|
-
|
54
|
+
# puts "Subset = #{Subset.inspect}"
|
55
|
+
|
56
|
+
Subset.each do |tdir|
|
51
57
|
define_method("test_#{tdir}") do
|
52
58
|
external_files(tdir)
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
62
|
+
def green(str)
|
63
|
+
"[32m" + str + "[0m"
|
64
|
+
end
|
65
|
+
|
66
|
+
def red(str)
|
67
|
+
"[31m" + str + "[0m"
|
68
|
+
end
|
69
|
+
|
56
70
|
def external_files(base)
|
57
71
|
Dir.chdir(base) do
|
58
72
|
src, out, exp = "source.lt3", "/tmp/#{base}--actual-output.txt", "expected-output.txt"
|
@@ -63,12 +77,15 @@ class TestingLivetext < MiniTest::Test
|
|
63
77
|
|
64
78
|
out_ok = output == expected
|
65
79
|
err_ok = errors == errexp
|
66
|
-
|
67
|
-
|
80
|
+
nout = output.split("\n").size
|
81
|
+
nexp = expected.split("\n").size
|
82
|
+
bad_out = "--- Expected (#{nexp} lines): \n#{green(expected)}\n--- Output (#{nout} lines): \n#{red(output)}\n"
|
83
|
+
bad_err = "--- Error Expected: \n#{green(errexp)}\n--- Error Output: \n#{red(errors)}\n"
|
68
84
|
|
69
85
|
assert(out_ok, bad_out)
|
70
86
|
assert(err_ok, bad_err)
|
71
|
-
|
87
|
+
# only on success
|
88
|
+
system("rm -f #{out} #{err}") if out_ok && err_ok
|
72
89
|
end
|
73
90
|
end
|
74
91
|
|
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.
|
4
|
+
version: 0.8.78
|
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-04-
|
11
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A smart text processor extensible in Ruby
|
14
14
|
email: rubyhacker@gmail.com
|
@@ -20,6 +20,8 @@ files:
|
|
20
20
|
- "./README.lt3"
|
21
21
|
- "./README.md"
|
22
22
|
- bin/livetext
|
23
|
+
- lib/SAVE.formatline
|
24
|
+
- lib/SAVE2.formatline.rb
|
23
25
|
- lib/formatline.rb
|
24
26
|
- lib/functions.rb
|
25
27
|
- lib/livetext.rb
|
@@ -36,6 +38,7 @@ files:
|
|
36
38
|
- test/affirm/kbks.jpg
|
37
39
|
- test/affirm/lm-kbks.lt
|
38
40
|
- test/cleanup
|
41
|
+
- test/data/SAVE.lines
|
39
42
|
- test/data/basic_formatting/expected-error.txt
|
40
43
|
- test/data/basic_formatting/expected-output.txt
|
41
44
|
- test/data/basic_formatting/source.lt3
|
@@ -123,6 +126,7 @@ files:
|
|
123
126
|
- test/data/single_raw_line/expected-error.txt
|
124
127
|
- test/data/single_raw_line/expected-output.txt
|
125
128
|
- test/data/single_raw_line/source.lt3
|
129
|
+
- test/data/subset.txt
|
126
130
|
- test/data/table_with_heredocs/expected-error.txt
|
127
131
|
- test/data/table_with_heredocs/expected-output.txt
|
128
132
|
- test/data/table_with_heredocs/source.lt3
|