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
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.23
4
+ version: 0.9.26
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-18 00:00:00.000000000 Z
11
+ date: 2022-03-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -27,26 +27,31 @@ files:
27
27
  - imports/pyggish.rb
28
28
  - imports/tutorial.rb
29
29
  - lib/cmdargs.rb
30
- - lib/errors.rb
31
- - lib/formatline.rb
32
- - lib/funcall.rb
33
- - lib/functions.rb
34
- - lib/global_helpers.rb
35
- - lib/handler.rb
36
- - lib/handler/import.rb
37
- - lib/helpers.rb
38
- - lib/html.rb
39
30
  - lib/livetext.rb
40
- - lib/parser.rb
41
- - lib/parser/file.rb
42
- - lib/parser/general.rb
43
- - lib/parser/mixin.rb
44
- - lib/parser/set.rb
45
- - lib/parser/string.rb
46
- - lib/parsing.rb
47
- - lib/processor.rb
48
- - lib/standard.rb
49
- - lib/userapi.rb
31
+ - lib/livetext/errors.rb
32
+ - lib/livetext/formatline.rb
33
+ - lib/livetext/funcall.rb
34
+ - lib/livetext/functions.rb
35
+ - lib/livetext/global_helpers.rb
36
+ - lib/livetext/handler.rb
37
+ - lib/livetext/handler/import.rb
38
+ - lib/livetext/handler/mixin.rb
39
+ - lib/livetext/helpers.rb
40
+ - lib/livetext/html.rb
41
+ - lib/livetext/lineparser.rb
42
+ - lib/livetext/more.rb
43
+ - lib/livetext/parser.rb
44
+ - lib/livetext/parser/general.rb
45
+ - lib/livetext/parser/set.rb
46
+ - lib/livetext/parser/string.rb
47
+ - lib/livetext/parsing.rb
48
+ - lib/livetext/paths.rb
49
+ - lib/livetext/processor.rb
50
+ - lib/livetext/reopen.rb
51
+ - lib/livetext/skeleton.rb
52
+ - lib/livetext/standard.rb
53
+ - lib/livetext/userapi.rb
54
+ - lib/livetext/version.rb
50
55
  - livetext.gemspec
51
56
  - plugin/bookish.rb
52
57
  - plugin/calibre.rb
@@ -56,8 +61,12 @@ files:
56
61
  - plugin/tutorial.rb
57
62
  - test/all.rb
58
63
  - test/snapshots.rb
64
+ - test/snapshots/basic_formatting/actual-error.txt
65
+ - test/snapshots/basic_formatting/actual-output.txt
66
+ - test/snapshots/basic_formatting/err-sdiff.txt
59
67
  - test/snapshots/basic_formatting/expected-error.txt
60
68
  - test/snapshots/basic_formatting/expected-output.txt
69
+ - test/snapshots/basic_formatting/out-sdiff.txt
61
70
  - test/snapshots/basic_formatting/source.lt3
62
71
  - test/snapshots/block_comment/expected-error.txt
63
72
  - test/snapshots/block_comment/expected-output.txt
@@ -72,18 +81,14 @@ files:
72
81
  - test/snapshots/def_method/expected-error.txt
73
82
  - test/snapshots/def_method/expected-output.txt
74
83
  - test/snapshots/def_method/source.lt3
75
- - test/snapshots/error_inc_line_num/OUT
76
- - test/snapshots/error_inc_line_num/actual-error.txt
77
- - test/snapshots/error_inc_line_num/actual-output.txt
84
+ - test/snapshots/error_inc_line_num/README.txt
78
85
  - test/snapshots/error_inc_line_num/expected-output.txt
79
86
  - test/snapshots/error_inc_line_num/file2.lt3
80
87
  - test/snapshots/error_inc_line_num/match-error.txt
81
88
  - test/snapshots/error_inc_line_num/source.lt3
82
- - test/snapshots/error_invalid_name/actual-error.txt
83
- - test/snapshots/error_invalid_name/actual-output.txt
84
89
  - test/snapshots/error_invalid_name/expected-output.txt
90
+ - test/snapshots/error_invalid_name/foo
85
91
  - test/snapshots/error_invalid_name/match-error.txt
86
- - test/snapshots/error_invalid_name/out-sdiff.txt
87
92
  - test/snapshots/error_invalid_name/source.lt3
88
93
  - test/snapshots/error_line_num/expected-output.txt
89
94
  - test/snapshots/error_line_num/match-error.txt
@@ -91,32 +96,20 @@ files:
91
96
  - test/snapshots/error_mismatched_end/expected-output.txt
92
97
  - test/snapshots/error_mismatched_end/match-error.txt
93
98
  - test/snapshots/error_mismatched_end/source.lt3
94
- - test/snapshots/error_missing_end/actual-error.txt
95
- - test/snapshots/error_missing_end/actual-output.txt
96
99
  - test/snapshots/error_missing_end/expected-output.txt
97
100
  - test/snapshots/error_missing_end/match-error.txt
98
- - test/snapshots/error_missing_end/out-sdiff.txt
99
101
  - test/snapshots/error_missing_end/source.lt3
100
102
  - test/snapshots/error_name_not_permitted/expected-output.txt
101
103
  - test/snapshots/error_name_not_permitted/match-error.txt
102
104
  - test/snapshots/error_name_not_permitted/source.lt3
103
- - test/snapshots/error_no_such_copy/actual-error.txt
104
- - test/snapshots/error_no_such_copy/actual-output.txt
105
105
  - test/snapshots/error_no_such_copy/expected-output.txt
106
106
  - test/snapshots/error_no_such_copy/match-error.txt
107
- - test/snapshots/error_no_such_copy/out-sdiff.txt
108
107
  - test/snapshots/error_no_such_copy/source.lt3
109
- - test/snapshots/error_no_such_inc/actual-error.txt
110
- - test/snapshots/error_no_such_inc/actual-output.txt
111
108
  - test/snapshots/error_no_such_inc/expected-output.txt
112
109
  - test/snapshots/error_no_such_inc/match-error.txt
113
- - test/snapshots/error_no_such_inc/out-sdiff.txt
114
110
  - test/snapshots/error_no_such_inc/source.lt3
115
- - test/snapshots/error_no_such_mixin/actual-error.txt
116
- - test/snapshots/error_no_such_mixin/actual-output.txt
117
111
  - test/snapshots/error_no_such_mixin/expected-output.txt
118
112
  - test/snapshots/error_no_such_mixin/match-error.txt
119
- - test/snapshots/error_no_such_mixin/out-sdiff.txt
120
113
  - test/snapshots/error_no_such_mixin/source.lt3
121
114
  - test/snapshots/example_alpha/expected-error.txt
122
115
  - test/snapshots/example_alpha/expected-output.txt
@@ -149,8 +142,12 @@ files:
149
142
  - test/snapshots/more_complex_vars/expected-error.txt
150
143
  - test/snapshots/more_complex_vars/expected-output.txt
151
144
  - test/snapshots/more_complex_vars/source.lt3
145
+ - test/snapshots/more_functions/actual-error.txt
146
+ - test/snapshots/more_functions/actual-output.txt
147
+ - test/snapshots/more_functions/err-sdiff.txt
152
148
  - test/snapshots/more_functions/expected-error.txt
153
149
  - test/snapshots/more_functions/expected-output.txt
150
+ - test/snapshots/more_functions/out-sdiff.txt
154
151
  - test/snapshots/more_functions/source.lt3
155
152
  - test/snapshots/predef_vars/expected-error.txt
156
153
  - test/snapshots/predef_vars/match-output.txt
@@ -178,8 +175,12 @@ files:
178
175
  - test/snapshots/simple_mixin/expected-output.txt
179
176
  - test/snapshots/simple_mixin/simple_mixin.rb
180
177
  - test/snapshots/simple_mixin/source.lt3
178
+ - test/snapshots/simple_vars/actual-error.txt
179
+ - test/snapshots/simple_vars/actual-output.txt
180
+ - test/snapshots/simple_vars/err-sdiff.txt
181
181
  - test/snapshots/simple_vars/expected-error.txt
182
182
  - test/snapshots/simple_vars/expected-output.txt
183
+ - test/snapshots/simple_vars/out-sdiff.txt
183
184
  - test/snapshots/simple_vars/source.lt3
184
185
  - test/snapshots/single_raw_line/expected-error.txt
185
186
  - test/snapshots/single_raw_line/expected-output.txt
@@ -188,10 +189,18 @@ files:
188
189
  - test/snapshots/table_with_heredocs/expected-error.txt
189
190
  - test/snapshots/table_with_heredocs/expected-output.txt
190
191
  - test/snapshots/table_with_heredocs/source.lt3
192
+ - test/snapshots/var_into_func/actual-error.txt
193
+ - test/snapshots/var_into_func/actual-output.txt
194
+ - test/snapshots/var_into_func/err-sdiff.txt
195
+ - test/snapshots/var_into_func/expected-error.txt
196
+ - test/snapshots/var_into_func/expected-output.txt
197
+ - test/snapshots/var_into_func/out-sdiff.txt
198
+ - test/snapshots/var_into_func/source.lt3
191
199
  - test/testlines.rb
192
200
  - test/unit/all.rb
193
201
  - test/unit/formatline.rb
194
202
  - test/unit/html.rb
203
+ - test/unit/lineparser.rb
195
204
  - test/unit/parser.rb
196
205
  - test/unit/parser/all.rb
197
206
  - test/unit/parser/general.rb
@@ -200,6 +209,7 @@ files:
200
209
  - test/unit/parser/string.rb
201
210
  - test/unit/standard.rb
202
211
  - test/unit/stringparser.rb
212
+ - test/unit/tokenizer.rb
203
213
  homepage: https://github.com/Hal9000/livetext
204
214
  licenses:
205
215
  - Ruby
data/lib/funcall.rb DELETED
@@ -1,93 +0,0 @@
1
- # p __FILE__
2
-
3
- require_relative 'livetext'
4
- # require_relative 'formatline'
5
-
6
- # Parse function calls
7
-
8
- module Livetext::FormatLine::FunCall
9
-
10
- include Livetext::ParsingConstants
11
-
12
- def grab_colon_param
13
- grab # grab :
14
- param = ""
15
- loop do
16
- case lookahead
17
- when Escape
18
- grab
19
- param << lookahead
20
- grab
21
- when Space, LF, nil; break
22
- else
23
- param << lookahead
24
- grab
25
- end
26
- end
27
-
28
- param = nil if param.empty?
29
- param
30
- end
31
-
32
- def grab_bracket_param
33
- grab # [
34
- param = ""
35
- loop do
36
- case lookahead
37
- when Escape
38
- grab
39
- param << lookahead
40
- grab
41
- when "]", LF, nil
42
- break
43
- else
44
- param << lookahead
45
- grab
46
- end
47
- end
48
- add peek
49
- grab
50
- param = nil if param.empty?
51
- param
52
- end
53
-
54
- def funcall(name, param)
55
- err = "[Error evaluating $$#{name}(#{param})]"
56
- func_name = name # "func_" + name.to_s
57
- result =
58
- if self.send?(func_name, param) # self.respond_to?(func_name)
59
- # do nothing
60
- else
61
- fobj = ::Livetext::Functions.new
62
- fobj.send(name, param) rescue err
63
- end
64
- result.to_s
65
- end
66
-
67
- def double_dollar
68
- case lookahead
69
- when Space; add_token :string, "$$ "; grab; return
70
- when LF, nil; add "$$"; add_token :str
71
- when Alpha
72
- add_token(:str, @token)
73
- func = grab_alpha
74
- add_token(:func, func)
75
- param = grab_func_param # may be null/missing
76
- else
77
- grab; add_token :str, "$$" + peek; return
78
- end
79
- end
80
-
81
- def grab_func_param
82
- case lookahead
83
- when "["
84
- param = grab_bracket_param
85
- add_token(:brackets, param)
86
- when ":"
87
- param = grab_colon_param
88
- add_token(:colon, param)
89
- else # do nothing
90
- end
91
- end
92
-
93
- end
data/lib/parser/file.rb DELETED
@@ -1,6 +0,0 @@
1
-
2
- # Hmm. not today?
3
-
4
- class Livetext::ParseFile
5
-
6
- end
data/lib/parser/mixin.rb DELETED
@@ -1,34 +0,0 @@
1
- require_relative '../helpers' # FIXME This seems wrong
2
-
3
- make_exception(:NoEqualSign, "Error: no equal sign found")
4
-
5
- class Livetext::ParseMixin
6
- include Livetext::Helpers
7
-
8
- def initialize(name)
9
- @name = name
10
- @file = find_file(name, ".rb", "plugin")
11
- end
12
-
13
- def self.get_module(name)
14
- parse = self.new(name)
15
- modname, code = parse.read_mixin
16
- eval(code) # Avoid in the future
17
- newmod = Object.const_get("::" + modname)
18
- newmod # return actual module
19
- end
20
-
21
- def read_mixin
22
- modname = @name.gsub("/","_").capitalize
23
- meths = grab_file(@file)
24
- [modname, "module ::#{modname}; #{meths}\nend"]
25
- end
26
-
27
- private
28
-
29
- def cwd_root?
30
- File.dirname(File.expand_path(".")) == "/"
31
- end
32
-
33
- end
34
-
data/lib/userapi.rb DELETED
@@ -1,164 +0,0 @@
1
- # p __FILE__
2
-
3
- require_relative 'formatline'
4
-
5
- # UserAPI deals mostly with user-level methods.
6
-
7
- module Livetext::UserAPI
8
-
9
- # FIXME I am tired of all my leading underscores...
10
- # FIXME Q: Could this be converted into a class?? What about its
11
- # interaction thru instance vars?
12
-
13
- def setvar(var, val)
14
- str, sym = var.to_s, var.to_sym
15
- Livetext::Vars[str] = val
16
- Livetext::Vars[sym] = val
17
- end
18
-
19
- def _check_existence(file, msg)
20
- _error! msg unless File.exist?(file)
21
- end
22
-
23
- def _source
24
- @input
25
- end
26
-
27
- def _args
28
- @_args = _format(@_data).chomp.split
29
- if block_given?
30
- @_args.each {|arg| yield arg }
31
- else
32
- @_args
33
- end
34
- end
35
-
36
- def _vars
37
- @_vars.dup
38
- end
39
-
40
- def _optional_blank_line
41
- peek = peek_nextline
42
- return if peek.nil?
43
- @line = nextline if peek =~ /^ *$/
44
- end
45
-
46
- def _comment?(str)
47
- sigil = Livetext::Sigil
48
- c1 = sigil + Livetext::Space
49
- c2 = sigil + sigil + Livetext::Space
50
- str.index(c1) == 0 || str.index(c2) == 0
51
- end
52
-
53
- def _trailing?(char)
54
- return true if ["\n", " ", nil].include?(char)
55
- return false
56
- end
57
-
58
- def _end?(str)
59
- return true if str == ".end" || str =~ / *\$\.end/
60
- return false
61
- end
62
-
63
- def _raw_body(tag = "__EOF__")
64
- lines = []
65
- # @save_location = @sources.last
66
- loop do
67
- @line = nextline
68
- break if @line.nil?
69
- break if @line.chomp.strip == tag
70
- lines << @line
71
- end
72
- _optional_blank_line
73
- if block_given?
74
- lines.each {|line| yield line }
75
- else
76
- lines
77
- end
78
- lines
79
- end
80
-
81
- def _body(raw=false)
82
- lines = []
83
- end_found = false
84
- loop do
85
- @line = nextline
86
- break if @line.nil?
87
- @line.chomp!
88
- break if _end?(@line)
89
- next if _comment?(@line)
90
- @line = _format(@line) unless raw
91
- lines << @line
92
- end
93
-
94
- raise "Expected .end, found end of file" unless _end?(@line)
95
-
96
- _optional_blank_line
97
- if block_given?
98
- lines.each {|line| yield line } # FIXME what about $. ?
99
- else
100
- lines
101
- end
102
- end
103
-
104
- def _body_text(raw=false)
105
- _raw_body.join("\n")
106
- end
107
-
108
- def _raw_body!
109
- _raw_body(Livetext::Sigil).join("\n")
110
- end
111
-
112
- def _handle_escapes(str, set)
113
- str = str.dup
114
- set.each_char do |ch|
115
- str.gsub!("\\#{ch}", ch)
116
- end
117
- str
118
- end
119
-
120
- def _format(line)
121
- return "" if line == "\n" || line.nil?
122
- line2 = Livetext::FormatLine.parse!(line)
123
- line.replace(line2)
124
- line
125
- end
126
-
127
- def _passthru(line)
128
- return if @_nopass
129
- _out "<p>" if line == "\n" and ! @_nopara
130
- line = _format(line)
131
- _out line
132
- end
133
-
134
- def _out(str = "", file = nil)
135
- return if str.nil?
136
- if file.nil? # FIXME do this elsewhere?
137
- @parent.body << str
138
- @parent.body << "\n" unless str.end_with?("\n")
139
- else
140
- file.puts str
141
- end
142
- end
143
-
144
- def _out!(str = "")
145
- @parent.body << str # no newline
146
- end
147
-
148
- def _puts(*args)
149
- @output.puts *args
150
- end
151
-
152
- def _print(*args)
153
- @output.print *args
154
- end
155
-
156
- def _debug=(val)
157
- @_debug = val
158
- end
159
-
160
- def _debug(*args)
161
- TTY.puts *args if @_debug
162
- end
163
-
164
- end
@@ -1,17 +0,0 @@
1
- This is my
2
- source file
3
- which includes file2 here:
4
- This is file2
5
- which has an error
6
- about an unknown command
7
- 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>
16
-
17
- And this is file2 line 7.
@@ -1,10 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:146:in `check_disallowed': Error: name 'to_s' is invalid (DisallowedName)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:142:in `dot_def'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
- from ../../../bin/livetext:86:in `block in <main>'
9
- from ../../../bin/livetext:57:in `loop'
10
- from ../../../bin/livetext:57:in `<main>'
@@ -1,6 +0,0 @@
1
- ACTUAL | EXPECTED
2
- > This file has
3
- > a defined method
4
- > that is invalid:
5
- > <p>
6
- >
@@ -1,10 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/userapi.rb:92:in `_body': Expected .end, found end of file (RuntimeError)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:48:in `comment'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
- from ../../../bin/livetext:86:in `block in <main>'
9
- from ../../../bin/livetext:57:in `loop'
10
- from ../../../bin/livetext:57:in `<main>'
@@ -1,6 +0,0 @@
1
- ACTUAL | EXPECTED
2
- > Blah
3
- > blah
4
- > <p>
5
- >
6
- >
@@ -1,10 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:150:in `check_file_exists': Error: file 'nosuchfile.txt' not found (FileNotFound)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:255:in `copy'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
- from ../../../bin/livetext:86:in `block in <main>'
9
- from ../../../bin/livetext:57:in `loop'
10
- from ../../../bin/livetext:57:in `<main>'
@@ -1,5 +0,0 @@
1
- ACTUAL | EXPECTED
2
- > Make sure a
3
- > nonexistent file with .copy
4
- > gives an error.
5
- > <p>
@@ -1,10 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:150:in `check_file_exists': Error: file 'nosuchinc.lt3' not found (FileNotFound)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:209:in `dot_include'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
- from ../../../bin/livetext:86:in `block in <main>'
9
- from ../../../bin/livetext:57:in `loop'
10
- from ../../../bin/livetext:57:in `<main>'
@@ -1,6 +0,0 @@
1
- ACTUAL | EXPECTED
2
- > Make sure
3
- > a nonexistent include
4
- > will give an error.
5
- > <p>
6
- >
@@ -1,13 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:36:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:12:in `initialize'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `new'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `get_module'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:234:in `mixin'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
8
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
9
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
10
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
11
- from ../../../bin/livetext:86:in `block in <main>'
12
- from ../../../bin/livetext:57:in `loop'
13
- from ../../../bin/livetext:57:in `<main>'
File without changes
@@ -1,6 +0,0 @@
1
- ACTUAL | EXPECTED
2
- > Test that
3
- > we give an error
4
- > when a mixin does not
5
- > exist:
6
- > <p>