livetext 0.9.21 → 0.9.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/imports/bookish.rb +8 -10
- data/imports/pyggish.rb +2 -34
- data/imports/tutorial.rb +2 -2
- data/lib/cmdargs.rb +2 -3
- data/lib/formatline.rb +101 -73
- data/lib/functions.rb +16 -1
- data/lib/handler/{icanhaz.rb → import.rb} +1 -1
- data/lib/handler.rb +1 -1
- data/lib/helpers.rb +10 -10
- data/lib/livetext.rb +12 -5
- data/lib/parser/set.rb +1 -3
- data/lib/parser/string.rb +2 -2
- data/lib/processor.rb +6 -2
- data/lib/standard.rb +15 -15
- data/lib/userapi.rb +4 -2
- data/plugin/bookish.rb +4 -5
- data/plugin/pyggish.rb +45 -77
- data/plugin/tutorial.rb +0 -1
- data/test/snapshots/error_inc_line_num/actual-error.txt +14 -0
- data/test/snapshots/error_inc_line_num/actual-output.txt +7 -0
- data/test/snapshots/error_inc_line_num/out-sdiff.txt +14 -0
- data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
- data/test/snapshots/{icanhaz2/expected-error.txt → error_invalid_name/actual-output.txt} +0 -0
- data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
- data/test/snapshots/error_missing_end/actual-error.txt +10 -0
- data/test/snapshots/error_missing_end/actual-output.txt +0 -0
- data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
- data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
- data/test/snapshots/error_no_such_copy/actual-output.txt +0 -0
- data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
- data/test/snapshots/error_no_such_inc/actual-output.txt +0 -0
- data/test/snapshots/error_no_such_mixin/actual-error.txt +13 -0
- data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
- data/test/snapshots/error_no_such_mixin/out-sdiff.txt +6 -0
- data/test/snapshots/import/actual-error.txt +13 -0
- data/test/snapshots/import/actual-output.txt +0 -0
- data/test/snapshots/{icanhaz → import}/expected-output.txt +0 -0
- data/test/snapshots/{icanhaz → import}/match-error.txt +0 -0
- data/test/snapshots/import/out-sdiff.txt +6 -0
- data/test/snapshots/{icanhaz → import}/simple_import.rb +0 -0
- data/test/snapshots/{icanhaz → import}/source.lt3 +2 -2
- data/test/snapshots/import2/expected-error.txt +0 -0
- data/test/snapshots/{icanhaz2 → import2}/expected-output.txt +3 -1
- data/test/snapshots/{icanhaz2/simple_canhaz.rb → import2/simple_import.rb} +0 -0
- data/test/snapshots/import2/source.lt3 +8 -0
- data/test/snapshots/more_functions/expected-error.txt +0 -0
- data/test/snapshots/more_functions/expected-output.txt +37 -0
- data/test/snapshots/more_functions/source.lt3 +40 -0
- data/test/snapshots/simple_import/expected-output.txt +2 -0
- data/test/snapshots/simple_import/source.lt3 +3 -1
- data/test/snapshots/subset.txt +11 -12
- data/test/snapshots/wtf_bookish/expected-error.txt +0 -0
- data/test/snapshots/wtf_bookish/expected-output.txt +10 -0
- data/test/snapshots/wtf_bookish/source.lt3 +7 -0
- data/test/snapshots/wtf_bookish/toc.tmp +0 -0
- data/test/snapshots.rb +6 -7
- data/test/unit/formatline.rb +252 -135
- data/test/unit/parser/set.rb +6 -10
- data/test/unit/parser/string.rb +5 -5
- data/test/unit/standard.rb +0 -1
- metadata +37 -13
- data/lib/livetext/importable.rb +0 -2
- data/lib/parser/import.rb +0 -15
- data/test/snapshots/icanhaz2/source.lt3 +0 -6
data/test/unit/parser/string.rb
CHANGED
@@ -58,7 +58,7 @@ class TestStringParser < MiniTest::Test
|
|
58
58
|
assert @zero.eos?
|
59
59
|
|
60
60
|
@one.grab
|
61
|
-
assert @one.eos?
|
61
|
+
assert @one.eos?
|
62
62
|
@one.grab
|
63
63
|
assert @one.eos?
|
64
64
|
|
@@ -90,7 +90,7 @@ class TestStringParser < MiniTest::Test
|
|
90
90
|
assert char2 == char1
|
91
91
|
assert char3 == @str1[1]
|
92
92
|
assert @one.i == 1
|
93
|
-
assert @one.eos?
|
93
|
+
assert @one.eos?
|
94
94
|
|
95
95
|
char1 = @many.peek
|
96
96
|
char2 = @many.grab
|
@@ -143,14 +143,14 @@ class TestStringParser < MiniTest::Test
|
|
143
143
|
assert_equal parse.peek, "c"
|
144
144
|
end
|
145
145
|
|
146
|
-
def
|
146
|
+
def test_lookahead
|
147
147
|
parse = StringParser.new("abcdef")
|
148
148
|
assert_equal parse.peek, "a"
|
149
|
-
assert_equal parse.
|
149
|
+
assert_equal parse.lookahead, "b"
|
150
150
|
assert_equal parse.i, 0
|
151
151
|
3.times { parse.grab }
|
152
152
|
before = parse.i
|
153
|
-
assert_equal parse.
|
153
|
+
assert_equal parse.lookahead, "e"
|
154
154
|
after = parse.i
|
155
155
|
assert_equal before, after
|
156
156
|
end
|
data/test/unit/standard.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-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
|
@@ -32,15 +32,13 @@ files:
|
|
32
32
|
- lib/formatline.rb
|
33
33
|
- lib/functions.rb
|
34
34
|
- lib/handler.rb
|
35
|
-
- lib/handler/
|
35
|
+
- lib/handler/import.rb
|
36
36
|
- lib/helpers.rb
|
37
37
|
- lib/html.rb
|
38
38
|
- lib/livetext.rb
|
39
|
-
- lib/livetext/importable.rb
|
40
39
|
- lib/parser.rb
|
41
40
|
- lib/parser/file.rb
|
42
41
|
- lib/parser/general.rb
|
43
|
-
- lib/parser/import.rb
|
44
42
|
- lib/parser/mixin.rb
|
45
43
|
- lib/parser/set.rb
|
46
44
|
- lib/parser/string.rb
|
@@ -72,12 +70,18 @@ files:
|
|
72
70
|
- test/snapshots/def_method/expected-error.txt
|
73
71
|
- test/snapshots/def_method/expected-output.txt
|
74
72
|
- test/snapshots/def_method/source.lt3
|
73
|
+
- test/snapshots/error_inc_line_num/actual-error.txt
|
74
|
+
- test/snapshots/error_inc_line_num/actual-output.txt
|
75
75
|
- test/snapshots/error_inc_line_num/expected-output.txt
|
76
76
|
- test/snapshots/error_inc_line_num/file2.lt3
|
77
77
|
- test/snapshots/error_inc_line_num/match-error.txt
|
78
|
+
- test/snapshots/error_inc_line_num/out-sdiff.txt
|
78
79
|
- test/snapshots/error_inc_line_num/source.lt3
|
80
|
+
- test/snapshots/error_invalid_name/actual-error.txt
|
81
|
+
- test/snapshots/error_invalid_name/actual-output.txt
|
79
82
|
- test/snapshots/error_invalid_name/expected-output.txt
|
80
83
|
- test/snapshots/error_invalid_name/match-error.txt
|
84
|
+
- test/snapshots/error_invalid_name/out-sdiff.txt
|
81
85
|
- test/snapshots/error_invalid_name/source.lt3
|
82
86
|
- test/snapshots/error_line_num/expected-output.txt
|
83
87
|
- test/snapshots/error_line_num/match-error.txt
|
@@ -85,20 +89,30 @@ files:
|
|
85
89
|
- test/snapshots/error_mismatched_end/expected-output.txt
|
86
90
|
- test/snapshots/error_mismatched_end/match-error.txt
|
87
91
|
- test/snapshots/error_mismatched_end/source.lt3
|
92
|
+
- test/snapshots/error_missing_end/actual-error.txt
|
93
|
+
- test/snapshots/error_missing_end/actual-output.txt
|
88
94
|
- test/snapshots/error_missing_end/expected-output.txt
|
89
95
|
- test/snapshots/error_missing_end/match-error.txt
|
96
|
+
- test/snapshots/error_missing_end/out-sdiff.txt
|
90
97
|
- test/snapshots/error_missing_end/source.lt3
|
91
98
|
- test/snapshots/error_name_not_permitted/expected-output.txt
|
92
99
|
- test/snapshots/error_name_not_permitted/match-error.txt
|
93
100
|
- test/snapshots/error_name_not_permitted/source.lt3
|
101
|
+
- test/snapshots/error_no_such_copy/actual-error.txt
|
102
|
+
- test/snapshots/error_no_such_copy/actual-output.txt
|
94
103
|
- test/snapshots/error_no_such_copy/expected-output.txt
|
95
104
|
- test/snapshots/error_no_such_copy/match-error.txt
|
96
105
|
- test/snapshots/error_no_such_copy/source.lt3
|
106
|
+
- test/snapshots/error_no_such_inc/actual-error.txt
|
107
|
+
- test/snapshots/error_no_such_inc/actual-output.txt
|
97
108
|
- test/snapshots/error_no_such_inc/expected-output.txt
|
98
109
|
- test/snapshots/error_no_such_inc/match-error.txt
|
99
110
|
- test/snapshots/error_no_such_inc/source.lt3
|
111
|
+
- test/snapshots/error_no_such_mixin/actual-error.txt
|
112
|
+
- test/snapshots/error_no_such_mixin/actual-output.txt
|
100
113
|
- test/snapshots/error_no_such_mixin/expected-output.txt
|
101
114
|
- test/snapshots/error_no_such_mixin/match-error.txt
|
115
|
+
- test/snapshots/error_no_such_mixin/out-sdiff.txt
|
102
116
|
- test/snapshots/error_no_such_mixin/source.lt3
|
103
117
|
- test/snapshots/example_alpha/expected-error.txt
|
104
118
|
- test/snapshots/example_alpha/expected-output.txt
|
@@ -112,17 +126,23 @@ files:
|
|
112
126
|
- test/snapshots/hello_world/expected-error.txt
|
113
127
|
- test/snapshots/hello_world/expected-output.txt
|
114
128
|
- test/snapshots/hello_world/source.lt3
|
115
|
-
- test/snapshots/
|
116
|
-
- test/snapshots/
|
117
|
-
- test/snapshots/
|
118
|
-
- test/snapshots/
|
119
|
-
- test/snapshots/
|
120
|
-
- test/snapshots/
|
121
|
-
- test/snapshots/
|
122
|
-
- test/snapshots/
|
129
|
+
- test/snapshots/import/actual-error.txt
|
130
|
+
- test/snapshots/import/actual-output.txt
|
131
|
+
- test/snapshots/import/expected-output.txt
|
132
|
+
- test/snapshots/import/match-error.txt
|
133
|
+
- test/snapshots/import/out-sdiff.txt
|
134
|
+
- test/snapshots/import/simple_import.rb
|
135
|
+
- test/snapshots/import/source.lt3
|
136
|
+
- test/snapshots/import2/expected-error.txt
|
137
|
+
- test/snapshots/import2/expected-output.txt
|
138
|
+
- test/snapshots/import2/simple_import.rb
|
139
|
+
- test/snapshots/import2/source.lt3
|
123
140
|
- test/snapshots/more_complex_vars/expected-error.txt
|
124
141
|
- test/snapshots/more_complex_vars/expected-output.txt
|
125
142
|
- test/snapshots/more_complex_vars/source.lt3
|
143
|
+
- test/snapshots/more_functions/expected-error.txt
|
144
|
+
- test/snapshots/more_functions/expected-output.txt
|
145
|
+
- test/snapshots/more_functions/source.lt3
|
126
146
|
- test/snapshots/predef_vars/expected-error.txt
|
127
147
|
- test/snapshots/predef_vars/match-output.txt
|
128
148
|
- test/snapshots/predef_vars/source.lt3
|
@@ -159,6 +179,10 @@ files:
|
|
159
179
|
- test/snapshots/table_with_heredocs/expected-error.txt
|
160
180
|
- test/snapshots/table_with_heredocs/expected-output.txt
|
161
181
|
- test/snapshots/table_with_heredocs/source.lt3
|
182
|
+
- test/snapshots/wtf_bookish/expected-error.txt
|
183
|
+
- test/snapshots/wtf_bookish/expected-output.txt
|
184
|
+
- test/snapshots/wtf_bookish/source.lt3
|
185
|
+
- test/snapshots/wtf_bookish/toc.tmp
|
162
186
|
- test/testlines.rb
|
163
187
|
- test/unit/all.rb
|
164
188
|
- test/unit/formatline.rb
|
data/lib/livetext/importable.rb
DELETED
data/lib/parser/import.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
require '../livetext/importable'
|
3
|
-
|
4
|
-
make_exception(:BadVariableName, "Error: invalid variable name")
|
5
|
-
make_exception(:NoEqualSign, "Error: no equal sign found")
|
6
|
-
|
7
|
-
class Livetext::Handler::Import
|
8
|
-
def use_import(name)
|
9
|
-
require name
|
10
|
-
include name
|
11
|
-
init = "init_#{name}"
|
12
|
-
self.send(init) if self.respond_to? init
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|