livetext 0.9.27 → 0.9.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +3 -2
  3. data/lib/livetext/expansion.rb +106 -0
  4. data/lib/livetext/formatter.rb +104 -0
  5. data/lib/livetext/functions.rb +9 -0
  6. data/lib/livetext/helpers.rb +23 -18
  7. data/lib/livetext/html.rb +73 -0
  8. data/lib/livetext/more.rb +24 -4
  9. data/lib/livetext/parser/general.rb +1 -1
  10. data/lib/livetext/parser/set.rb +10 -3
  11. data/lib/livetext/processor.rb +5 -0
  12. data/lib/livetext/standard.rb +16 -6
  13. data/lib/livetext/userapi.rb +39 -16
  14. data/lib/livetext/version.rb +1 -1
  15. data/lib/livetext.rb +1 -1
  16. data/plugin/bootstrap_menu.rb +140 -0
  17. data/plugin/misc/navbar.rb +162 -0
  18. data/test/snapshots/basic_formatting/expected-output.txt +1 -2
  19. data/test/snapshots/{basic_formatting/actual-error.txt → bootstrap_menu/expected-error.txt} +0 -0
  20. data/test/snapshots/bootstrap_menu/expected-output.txt +4 -0
  21. data/test/snapshots/bootstrap_menu/source.lt3 +17 -0
  22. data/test/snapshots/subset.txt +50 -48
  23. data/test/unit/all.rb +2 -2
  24. data/test/unit/lineparser.rb +1 -1
  25. data/test/unit/parser/general.rb +2 -2
  26. data/test/unit/parser/set.rb +0 -9
  27. metadata +9 -32
  28. data/lib/livetext/funcall.rb +0 -87
  29. data/lib/livetext/lineparser.rb +0 -575
  30. data/test/snapshots/basic_formatting/actual-output.txt +0 -13
  31. data/test/snapshots/basic_formatting/err-sdiff.txt +0 -1
  32. data/test/snapshots/basic_formatting/out-sdiff.txt +0 -14
  33. data/test/snapshots/functions/actual-error.txt +0 -19
  34. data/test/snapshots/functions/actual-output.txt +0 -0
  35. data/test/snapshots/functions/err-sdiff.txt +0 -20
  36. data/test/snapshots/import_bookish/toc.tmp +0 -0
  37. data/test/snapshots/mixin_bookish/toc.tmp +0 -0
  38. data/test/snapshots/more_complex_vars/actual-error.txt +0 -0
  39. data/test/snapshots/more_complex_vars/actual-output.txt +0 -4
  40. data/test/snapshots/more_complex_vars/err-sdiff.txt +0 -1
  41. data/test/snapshots/more_complex_vars/out-sdiff.txt +0 -5
  42. data/test/snapshots/more_functions/actual-error.txt +0 -19
  43. data/test/snapshots/more_functions/actual-output.txt +0 -0
  44. data/test/snapshots/more_functions/err-sdiff.txt +0 -20
  45. data/test/snapshots/raw_lines/actual-error.txt +0 -22
  46. data/test/snapshots/raw_lines/actual-output.txt +0 -0
  47. data/test/snapshots/raw_lines/err-sdiff.txt +0 -23
  48. data/test/snapshots/simple_vars/actual-error.txt +0 -0
  49. data/test/snapshots/simple_vars/actual-output.txt +0 -6
  50. data/test/snapshots/simple_vars/err-sdiff.txt +0 -1
  51. data/test/snapshots/simple_vars/out-sdiff.txt +0 -7
  52. data/test/snapshots/var_into_func/actual-error.txt +0 -19
  53. data/test/snapshots/var_into_func/actual-output.txt +0 -0
  54. data/test/snapshots/var_into_func/err-sdiff.txt +0 -20
  55. data/test/snapshots/var_into_func/out-sdiff.txt +0 -17
  56. data/test/unit/tokenizer.rb +0 -535
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.27
4
+ version: 0.9.30
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-04-29 00:00:00.000000000 Z
11
+ date: 2022-07-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -29,7 +29,8 @@ files:
29
29
  - lib/cmdargs.rb
30
30
  - lib/livetext.rb
31
31
  - lib/livetext/errors.rb
32
- - lib/livetext/funcall.rb
32
+ - lib/livetext/expansion.rb
33
+ - lib/livetext/formatter.rb
33
34
  - lib/livetext/functions.rb
34
35
  - lib/livetext/global_helpers.rb
35
36
  - lib/livetext/handler.rb
@@ -37,7 +38,6 @@ files:
37
38
  - lib/livetext/handler/mixin.rb
38
39
  - lib/livetext/helpers.rb
39
40
  - lib/livetext/html.rb
40
- - lib/livetext/lineparser.rb
41
41
  - lib/livetext/more.rb
42
42
  - lib/livetext/parser.rb
43
43
  - lib/livetext/parser/general.rb
@@ -53,23 +53,24 @@ files:
53
53
  - lib/livetext/version.rb
54
54
  - livetext.gemspec
55
55
  - plugin/bookish.rb
56
+ - plugin/bootstrap_menu.rb
56
57
  - plugin/calibre.rb
57
58
  - plugin/livemagick.rb
58
59
  - plugin/markdown.rb
60
+ - plugin/misc/navbar.rb
59
61
  - plugin/pyggish.rb
60
62
  - plugin/tutorial.rb
61
63
  - test/all.rb
62
64
  - test/snapshots.rb
63
- - test/snapshots/basic_formatting/actual-error.txt
64
- - test/snapshots/basic_formatting/actual-output.txt
65
- - test/snapshots/basic_formatting/err-sdiff.txt
66
65
  - test/snapshots/basic_formatting/expected-error.txt
67
66
  - test/snapshots/basic_formatting/expected-output.txt
68
- - test/snapshots/basic_formatting/out-sdiff.txt
69
67
  - test/snapshots/basic_formatting/source.lt3
70
68
  - test/snapshots/block_comment/expected-error.txt
71
69
  - test/snapshots/block_comment/expected-output.txt
72
70
  - test/snapshots/block_comment/source.lt3
71
+ - test/snapshots/bootstrap_menu/expected-error.txt
72
+ - test/snapshots/bootstrap_menu/expected-output.txt
73
+ - test/snapshots/bootstrap_menu/source.lt3
73
74
  - test/snapshots/comments_ignored_1/expected-error.txt
74
75
  - test/snapshots/comments_ignored_1/expected-output.txt
75
76
  - test/snapshots/comments_ignored_1/source.lt3
@@ -116,9 +117,6 @@ files:
116
117
  - test/snapshots/example_alpha2/expected-error.txt
117
118
  - test/snapshots/example_alpha2/expected-output.txt
118
119
  - test/snapshots/example_alpha2/source.lt3
119
- - test/snapshots/functions/actual-error.txt
120
- - test/snapshots/functions/actual-output.txt
121
- - test/snapshots/functions/err-sdiff.txt
122
120
  - test/snapshots/functions/expected-error.txt
123
121
  - test/snapshots/functions/expected-output.txt
124
122
  - test/snapshots/functions/source.lt3
@@ -136,30 +134,18 @@ files:
136
134
  - test/snapshots/import_bookish/expected-error.txt
137
135
  - test/snapshots/import_bookish/expected-output.txt
138
136
  - test/snapshots/import_bookish/source.lt3
139
- - test/snapshots/import_bookish/toc.tmp
140
137
  - test/snapshots/mixin_bookish/expected-error.txt
141
138
  - test/snapshots/mixin_bookish/expected-output.txt
142
139
  - test/snapshots/mixin_bookish/source.lt3
143
- - test/snapshots/mixin_bookish/toc.tmp
144
- - test/snapshots/more_complex_vars/actual-error.txt
145
- - test/snapshots/more_complex_vars/actual-output.txt
146
- - test/snapshots/more_complex_vars/err-sdiff.txt
147
140
  - test/snapshots/more_complex_vars/expected-error.txt
148
141
  - test/snapshots/more_complex_vars/expected-output.txt
149
- - test/snapshots/more_complex_vars/out-sdiff.txt
150
142
  - test/snapshots/more_complex_vars/source.lt3
151
- - test/snapshots/more_functions/actual-error.txt
152
- - test/snapshots/more_functions/actual-output.txt
153
- - test/snapshots/more_functions/err-sdiff.txt
154
143
  - test/snapshots/more_functions/expected-error.txt
155
144
  - test/snapshots/more_functions/expected-output.txt
156
145
  - test/snapshots/more_functions/source.lt3
157
146
  - test/snapshots/predef_vars/expected-error.txt
158
147
  - test/snapshots/predef_vars/match-output.txt
159
148
  - test/snapshots/predef_vars/source.lt3
160
- - test/snapshots/raw_lines/actual-error.txt
161
- - test/snapshots/raw_lines/actual-output.txt
162
- - test/snapshots/raw_lines/err-sdiff.txt
163
149
  - test/snapshots/raw_lines/expected-error.txt
164
150
  - test/snapshots/raw_lines/expected-output.txt
165
151
  - test/snapshots/raw_lines/source.lt3
@@ -183,12 +169,8 @@ files:
183
169
  - test/snapshots/simple_mixin/expected-output.txt
184
170
  - test/snapshots/simple_mixin/simple_mixin.rb
185
171
  - test/snapshots/simple_mixin/source.lt3
186
- - test/snapshots/simple_vars/actual-error.txt
187
- - test/snapshots/simple_vars/actual-output.txt
188
- - test/snapshots/simple_vars/err-sdiff.txt
189
172
  - test/snapshots/simple_vars/expected-error.txt
190
173
  - test/snapshots/simple_vars/expected-output.txt
191
- - test/snapshots/simple_vars/out-sdiff.txt
192
174
  - test/snapshots/simple_vars/source.lt3
193
175
  - test/snapshots/single_raw_line/expected-error.txt
194
176
  - test/snapshots/single_raw_line/expected-output.txt
@@ -197,12 +179,8 @@ files:
197
179
  - test/snapshots/table_with_heredocs/expected-error.txt
198
180
  - test/snapshots/table_with_heredocs/expected-output.txt
199
181
  - test/snapshots/table_with_heredocs/source.lt3
200
- - test/snapshots/var_into_func/actual-error.txt
201
- - test/snapshots/var_into_func/actual-output.txt
202
- - test/snapshots/var_into_func/err-sdiff.txt
203
182
  - test/snapshots/var_into_func/expected-error.txt
204
183
  - test/snapshots/var_into_func/expected-output.txt
205
- - test/snapshots/var_into_func/out-sdiff.txt
206
184
  - test/snapshots/var_into_func/source.lt3
207
185
  - test/unit/all.rb
208
186
  - test/unit/html.rb
@@ -216,7 +194,6 @@ files:
216
194
  - test/unit/parser/string.rb
217
195
  - test/unit/standard.rb
218
196
  - test/unit/stringparser.rb
219
- - test/unit/tokenizer.rb
220
197
  homepage: https://github.com/Hal9000/livetext
221
198
  licenses:
222
199
  - Ruby
@@ -1,87 +0,0 @@
1
-
2
- require_relative '../livetext'
3
-
4
- # Parse function calls
5
-
6
- module Livetext::LineParser::FunCall
7
-
8
- include Livetext::ParsingConstants
9
-
10
- def param_loop(char)
11
- param = ""
12
- loop do
13
- case peek
14
- when Escape
15
- param << escaped
16
- when char, LF, nil
17
- break
18
- else
19
- param << grab
20
- end
21
- end
22
- param = nil if param.empty?
23
- param
24
- end
25
-
26
- def grab_colon_param
27
- grab # grab :
28
- param = param_loop(Space)
29
- end
30
-
31
- def grab_bracket_param
32
- grab # [
33
- param = param_loop("]")
34
- grab # "]"
35
- param
36
- end
37
-
38
- def funcall(name, param)
39
- err = "[Error evaluating $$#{name}(#{param})]"
40
- name = name.gsub(/\./, "__")
41
- result =
42
- if self.send?(name, param)
43
- # do nothing
44
- else
45
- fobj = ::Livetext::Functions.new
46
- fobj.send(name, param) rescue err
47
- end
48
- result.to_s
49
- end
50
-
51
- def grab_func_with_param
52
- add_token(:str, @token)
53
- func = grab_alpha
54
- add_token(:func, func)
55
- param = grab_func_param(grab) # may be null/missing
56
- param
57
- end
58
-
59
- def double_dollar
60
- case peek
61
- when Space; add_token :string, "$$ "; grab
62
- when LF, nil; add "$$ "; add_token :str
63
- when Alpha; param = grab_func_with_param
64
- else grab; add_token :str, "$$" + peek
65
- end
66
- end
67
-
68
- # def grab_func_param
69
- # case peek
70
- # when "["
71
- # param = grab_bracket_param
72
- # add_token(:brackets, param)
73
- # when ":"
74
- # param = grab_colon_param
75
- # add_token(:colon, param)
76
- # else # do nothing
77
- # end
78
- # end
79
-
80
- def escaped
81
- grab # Eat the backslash
82
- ch = grab # Take next char
83
- ch
84
- end
85
-
86
- end
87
-