livetext 0.9.11 → 0.9.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/lib/errors.rb +13 -0
  3. data/lib/formatline.rb +3 -5
  4. data/lib/functions.rb +6 -2
  5. data/lib/helpers.rb +21 -0
  6. data/lib/html.rb +32 -0
  7. data/lib/livetext/importable.rb +2 -0
  8. data/lib/livetext.rb +44 -42
  9. data/lib/parser/general.rb +38 -0
  10. data/lib/parser/import.rb +17 -0
  11. data/lib/parser/mixin.rb +46 -0
  12. data/lib/parser/set.rb +136 -0
  13. data/lib/parser/string.rb +55 -0
  14. data/lib/parser.rb +5 -0
  15. data/lib/processor.rb +22 -16
  16. data/lib/standard.rb +144 -292
  17. data/lib/userapi.rb +2 -1
  18. data/livetext.gemspec +1 -2
  19. data/test/all.rb +3 -0
  20. data/test/formatting.rb +2 -9
  21. data/test/{data → snapshots}/basic_formatting/expected-error.txt +0 -0
  22. data/test/{data → snapshots}/basic_formatting/expected-output.txt +0 -0
  23. data/test/{data → snapshots}/basic_formatting/source.lt3 +0 -0
  24. data/test/{data → snapshots}/block_comment/expected-error.txt +0 -0
  25. data/test/{data → snapshots}/block_comment/expected-output.txt +0 -0
  26. data/test/{data → snapshots}/block_comment/source.lt3 +0 -0
  27. data/test/{data → snapshots}/comments_ignored_1/expected-error.txt +0 -0
  28. data/test/{data → snapshots}/comments_ignored_1/expected-output.txt +0 -0
  29. data/test/{data → snapshots}/comments_ignored_1/source.lt3 +0 -0
  30. data/test/{data → snapshots}/copy_is_raw/expected-error.txt +0 -0
  31. data/test/{data → snapshots}/copy_is_raw/expected-output.txt +0 -0
  32. data/test/{data → snapshots}/copy_is_raw/rawtext.inc +0 -0
  33. data/test/{data → snapshots}/copy_is_raw/source.lt3 +0 -0
  34. data/test/{data → snapshots}/crap +0 -0
  35. data/test/{data → snapshots}/def_method/expected-error.txt +0 -0
  36. data/test/{data → snapshots}/def_method/expected-output.txt +0 -0
  37. data/test/{data → snapshots}/def_method/source.lt3 +0 -0
  38. data/test/{data/error_inc_line_num/expected-err-line1match.txt → snapshots/error_inc_line_num/actual-error.txt} +0 -0
  39. data/test/{data/error_inc_line_num/expected-output.txt → snapshots/error_inc_line_num/actual-output.txt} +0 -0
  40. data/test/{data/error_line_num → snapshots/error_inc_line_num}/expected-err-line1match.txt +0 -0
  41. data/test/snapshots/error_inc_line_num/expected-output.txt +13 -0
  42. data/test/{data → snapshots}/error_inc_line_num/file2.lt3 +0 -0
  43. data/test/snapshots/error_inc_line_num/out-sdiff.txt +14 -0
  44. data/test/{data → snapshots}/error_inc_line_num/source.lt3 +0 -0
  45. data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
  46. data/test/{data/error_no_such_mixin/expected-output.txt → snapshots/error_invalid_name/actual-output.txt} +0 -0
  47. data/test/{data → snapshots}/error_invalid_name/expected-err-line1match.txt +0 -0
  48. data/test/{data → snapshots}/error_invalid_name/expected-output.txt +0 -0
  49. data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
  50. data/test/{data → snapshots}/error_invalid_name/source.lt3 +0 -0
  51. data/test/snapshots/error_line_num/actual-error.txt +1 -0
  52. data/test/snapshots/error_line_num/actual-output.txt +5 -0
  53. data/test/snapshots/error_line_num/expected-err-line1match.txt +1 -0
  54. data/test/{data → snapshots}/error_line_num/expected-output.txt +0 -0
  55. data/test/snapshots/error_line_num/out-sdiff.txt +6 -0
  56. data/test/{data → snapshots}/error_line_num/source.lt3 +0 -0
  57. data/test/snapshots/error_mismatched_end/actual-error.txt +1 -0
  58. data/test/{data/error_mismatched_end/expected-output.txt → snapshots/error_mismatched_end/actual-output.txt} +0 -0
  59. data/test/{data → snapshots}/error_mismatched_end/expected-err-line1match.txt +0 -0
  60. data/test/snapshots/error_mismatched_end/expected-output.txt +8 -0
  61. data/test/snapshots/error_mismatched_end/out-sdiff.txt +9 -0
  62. data/test/{data → snapshots}/error_mismatched_end/source.lt3 +0 -0
  63. data/test/{data/error_missing_end/expected-err-line1match.txt → snapshots/error_missing_end/actual-error.txt} +0 -0
  64. data/test/{data/error_missing_end/expected-output.txt → snapshots/error_missing_end/actual-output.txt} +0 -0
  65. data/test/snapshots/error_missing_end/expected-err-line1match.txt +1 -0
  66. data/test/snapshots/error_missing_end/expected-output.txt +5 -0
  67. data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
  68. data/test/{data → snapshots}/error_missing_end/source.lt3 +0 -0
  69. data/test/{data/error_name_not_permitted/expected-output.txt → snapshots/error_name_not_permitted/OLD-exp-out} +0 -0
  70. data/test/{data/example_alpha/expected-error.txt → snapshots/error_name_not_permitted/expected-output.txt} +0 -0
  71. data/test/snapshots/error_name_not_permitted/match-error.txt +1 -0
  72. data/test/{data → snapshots}/error_name_not_permitted/source.lt3 +0 -0
  73. data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
  74. data/test/{data/example_alpha2/expected-error.txt → snapshots/error_no_such_copy/actual-output.txt} +0 -0
  75. data/test/snapshots/error_no_such_copy/expected-err-line1match.txt +1 -0
  76. data/test/{data → snapshots}/error_no_such_copy/expected-output.txt +0 -5
  77. data/test/snapshots/error_no_such_copy/out-sdiff.txt +5 -0
  78. data/test/{data → snapshots}/error_no_such_copy/source.lt3 +0 -0
  79. data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
  80. data/test/{data/functions/expected-error.txt → snapshots/error_no_such_inc/actual-output.txt} +0 -0
  81. data/test/snapshots/error_no_such_inc/expected-err-line1match.txt +1 -0
  82. data/test/{data → snapshots}/error_no_such_inc/expected-output.txt +0 -4
  83. data/test/snapshots/error_no_such_inc/out-sdiff.txt +6 -0
  84. data/test/{data → snapshots}/error_no_such_inc/source.lt3 +0 -0
  85. data/test/snapshots/error_no_such_mixin/actual-error.txt +1 -0
  86. data/test/snapshots/error_no_such_mixin/actual-output.txt +11 -0
  87. data/test/{data → snapshots}/error_no_such_mixin/expected-err-line1match.txt +0 -0
  88. data/test/snapshots/error_no_such_mixin/expected-output.txt +5 -0
  89. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +12 -0
  90. data/test/{data → snapshots}/error_no_such_mixin/source.lt3 +0 -0
  91. data/test/{data/hello_world → snapshots/example_alpha}/expected-error.txt +0 -0
  92. data/test/{data → snapshots}/example_alpha/expected-output.txt +0 -0
  93. data/test/{data → snapshots}/example_alpha/source.lt3 +0 -0
  94. data/test/{data/more_complex_vars → snapshots/example_alpha2}/expected-error.txt +0 -0
  95. data/test/{data → snapshots}/example_alpha2/expected-output.txt +0 -0
  96. data/test/{data → snapshots}/example_alpha2/source.lt3 +0 -0
  97. data/test/{data → snapshots}/fixit +0 -0
  98. data/test/{data/predef_vars → snapshots/functions}/expected-error.txt +0 -0
  99. data/test/{data → snapshots}/functions/expected-output.txt +0 -0
  100. data/test/{data → snapshots}/functions/source.lt3 +0 -0
  101. data/test/{data/raw_lines → snapshots/hello_world}/expected-error.txt +0 -0
  102. data/test/{data → snapshots}/hello_world/expected-output.txt +0 -0
  103. data/test/{data → snapshots}/hello_world/source.lt3 +0 -0
  104. data/test/{data → snapshots}/lines.txt +0 -0
  105. data/test/{data/raw_text_block → snapshots/more_complex_vars}/expected-error.txt +0 -0
  106. data/test/{data → snapshots}/more_complex_vars/expected-output.txt +0 -0
  107. data/test/{data → snapshots}/more_complex_vars/source.lt3 +0 -0
  108. data/test/{data/simple_copy/expected-error.txt → snapshots/predef_vars/actual-error.txt} +0 -0
  109. data/test/snapshots/predef_vars/actual-output.txt +6 -0
  110. data/test/{data/simple_include → snapshots/predef_vars}/expected-error.txt +0 -0
  111. data/test/{data → snapshots}/predef_vars/expected-output.txt +1 -1
  112. data/test/snapshots/predef_vars/out-sdiff.txt +7 -0
  113. data/test/{data → snapshots}/predef_vars/source.lt3 +0 -0
  114. data/test/{data/simple_mixin → snapshots/raw_lines}/expected-error.txt +0 -0
  115. data/test/{data → snapshots}/raw_lines/expected-output.txt +0 -0
  116. data/test/{data → snapshots}/raw_lines/source.lt3 +0 -0
  117. data/test/{data/simple_vars → snapshots/raw_text_block}/expected-error.txt +0 -0
  118. data/test/{data → snapshots}/raw_text_block/expected-output.txt +0 -0
  119. data/test/{data → snapshots}/raw_text_block/rawtext.inc +0 -0
  120. data/test/{data → snapshots}/raw_text_block/source.lt3 +0 -0
  121. data/test/{data/single_raw_line → snapshots/simple_copy}/expected-error.txt +0 -0
  122. data/test/{data → snapshots}/simple_copy/expected-output.txt +0 -0
  123. data/test/{data → snapshots}/simple_copy/simplefile.inc +0 -0
  124. data/test/{data → snapshots}/simple_copy/source.lt3 +0 -0
  125. data/test/{data/table_with_heredocs → snapshots/simple_include}/expected-error.txt +0 -0
  126. data/test/{data → snapshots}/simple_include/expected-output.txt +0 -0
  127. data/test/{data → snapshots}/simple_include/simplefile.inc +0 -0
  128. data/test/{data → snapshots}/simple_include/source.lt3 +0 -0
  129. data/test/snapshots/simple_mixin/actual-error.txt +2 -0
  130. data/test/snapshots/simple_mixin/actual-output.txt +4 -0
  131. data/test/{data/subset.txt → snapshots/simple_mixin/expected-error.txt} +0 -0
  132. data/test/{data → snapshots}/simple_mixin/expected-output.txt +0 -0
  133. data/test/snapshots/simple_mixin/out-sdiff.txt +6 -0
  134. data/test/{data → snapshots}/simple_mixin/simple_mixin.rb +0 -0
  135. data/test/{data → snapshots}/simple_mixin/source.lt3 +0 -0
  136. data/test/snapshots/simple_vars/expected-error.txt +0 -0
  137. data/test/{data → snapshots}/simple_vars/expected-output.txt +0 -0
  138. data/test/{data → snapshots}/simple_vars/source.lt3 +0 -0
  139. data/test/snapshots/single_raw_line/expected-error.txt +0 -0
  140. data/test/{data → snapshots}/single_raw_line/expected-output.txt +0 -0
  141. data/test/{data → snapshots}/single_raw_line/source.lt3 +0 -0
  142. data/test/snapshots/subset.txt +0 -0
  143. data/test/snapshots/table_with_heredocs/expected-error.txt +0 -0
  144. data/test/{data → snapshots}/table_with_heredocs/expected-output.txt +0 -0
  145. data/test/{data → snapshots}/table_with_heredocs/source.lt3 +0 -0
  146. data/test/snapshots.rb +219 -0
  147. data/test/testlines.rb +2 -2
  148. data/test/unit/all.rb +3 -0
  149. data/test/unit/html.rb +38 -0
  150. data/test/unit/parse_misc.rb +60 -0
  151. data/test/unit/parse_set.rb +157 -0
  152. data/test/unit/parser/all.rb +3 -0
  153. data/test/unit/parser/general.rb +59 -0
  154. data/test/unit/parser/importable.rb +19 -0
  155. data/test/unit/parser/mixin.rb +19 -0
  156. data/test/unit/parser/set.rb +157 -0
  157. data/test/unit/parser/string.rb +130 -0
  158. data/test/unit/parser.rb +4 -0
  159. data/test/unit/standard.rb +23 -0
  160. data/test/unit/stringparser.rb +140 -0
  161. metadata +152 -99
  162. data/test/data/error_inc_line_num/FOO +0 -21
  163. data/test/data/error_missing_end/ERR +0 -32
  164. data/test/data/error_name_not_permitted/expected-error.txt +0 -1
  165. data/test/data/error_no_such_copy/expected-err-line1match.txt +0 -1
  166. data/test/data/error_no_such_inc/expected-err-line1match.txt +0 -1
  167. data/test/test.rb +0 -140
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,13 @@
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
+ <p>
9
+
10
+ And this is file2 line 7.
11
+ And here we are
12
+ back in the
13
+ original file.
@@ -0,0 +1,14 @@
1
+ EXPECTED | ACTUAL
2
+ This is my This is my
3
+ source file source file
4
+ which includes file2 here: which includes file2 here:
5
+ This is file2 This is file2
6
+ which has an error which has an error
7
+ about an unknown command about an unknown command
8
+ in line 5 in line 5
9
+ <p> <p>
10
+
11
+ And this is file2 line 7. And this is file2 line 7.
12
+ And here we are And here we are
13
+ back in the back in the
14
+ original file. original file.
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:7:in `check_disallowed': to_s (DisallowedName)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:142:in `_def'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:232:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:141:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:203:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ EXPECTED | ACTUAL
2
+ > This file has
3
+ > a defined method
4
+ > that is invalid:
5
+ > <p>
6
+ >
@@ -0,0 +1 @@
1
+ Error: Name 'foobar' is unknown
@@ -0,0 +1,5 @@
1
+ This file
2
+ will have an error
3
+ on line 4
4
+ if all goes
5
+ well.
@@ -0,0 +1 @@
1
+ Error: Name 'foobar' is unknown
@@ -0,0 +1,6 @@
1
+ EXPECTED | ACTUAL
2
+ This file This file
3
+ will have an error will have an error
4
+ on line 4 on line 4
5
+ if all goes <
6
+ well. <
File without changes
@@ -0,0 +1 @@
1
+ Error: Name 'end' is unknown
@@ -0,0 +1,8 @@
1
+ It is an error
2
+ to specify .end
3
+ without something
4
+ beginning a block:
5
+ <p>
6
+
7
+ foo bar
8
+ baz
@@ -0,0 +1,9 @@
1
+ EXPECTED | ACTUAL
2
+ It is an error It is an error
3
+ to specify .end to specify .end
4
+ without something without something
5
+ beginning a block: beginning a block:
6
+ <p> <p>
7
+
8
+ foo bar foo bar
9
+ baz baz
@@ -0,0 +1 @@
1
+ Error: #<RuntimeError: Expected .end, found end of file>
@@ -0,0 +1,5 @@
1
+ Blah
2
+ blah
3
+ <p>
4
+
5
+
@@ -0,0 +1,6 @@
1
+ EXPECTED | ACTUAL
2
+ Blah Blah
3
+ blah blah
4
+ <p> <p>
5
+
6
+
@@ -0,0 +1 @@
1
+ 1 /Disallowed/
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:11:in `check_file_exists': Error: file nosuchfile.txt not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:280:in `copy'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:232:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:141:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:203:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1 @@
1
+ Error: file nosuchfile.txt not found
@@ -2,8 +2,3 @@ Make sure a
2
2
  nonexistent file with .copy
3
3
  gives an error.
4
4
  <p>
5
-
6
- <p>
7
-
8
- Nothing to
9
- see here.
@@ -0,0 +1,5 @@
1
+ EXPECTED | ACTUAL
2
+ > Make sure a
3
+ > nonexistent file with .copy
4
+ > gives an error.
5
+ > <p>
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:11:in `check_file_exists': Error: file nosuchinc.lt3 not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:237:in `_include'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:232:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:141:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:203:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext.rb:200:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1 @@
1
+ Error: file nosuchinc.lt3 not found
@@ -3,7 +3,3 @@ a nonexistent include
3
3
  will give an error.
4
4
  <p>
5
5
 
6
- <p>
7
-
8
- Nothing to
9
- see here.
@@ -0,0 +1,6 @@
1
+ EXPECTED | ACTUAL
2
+ > Make sure
3
+ > a nonexistent include
4
+ > will give an error.
5
+ > <p>
6
+ >
@@ -0,0 +1 @@
1
+ Error: #<ArgumentError: wrong number of arguments (given 1, expected 0)>
@@ -0,0 +1,11 @@
1
+ Test that
2
+ we give an error
3
+ when a mixin does not
4
+ exist:
5
+ <p>
6
+
7
+ <p>
8
+
9
+ We shouldn't
10
+ reach this point
11
+ in the file.
@@ -0,0 +1,5 @@
1
+ Test that
2
+ we give an error
3
+ when a mixin does not
4
+ exist:
5
+ <p>
@@ -0,0 +1,12 @@
1
+ EXPECTED | ACTUAL
2
+ Test that | Test that
3
+ we give an error we give an error
4
+ when a mixin does not when a mixin does not
5
+ exist: exist:
6
+ <p> <p>
7
+ <
8
+ <p> <
9
+ <
10
+ We shouldn't <
11
+ reach this point <
12
+ in the file. <
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ Here we go...
2
+ File = source.lt3
3
+ FileDir = /Users/Hal/Dropbox/topx/git/livetext/test/snapshots/predef_vars
4
+ User = Hal
5
+ Version = 0.9.12
6
+ NoSuchVar = [NoSuchVar is undefined]
@@ -1,6 +1,6 @@
1
1
  Here we go...
2
2
  File = source.lt3
3
- FileDir = /Users/Hal/Dropbox/topx/git/livetext/test/data/predef_vars
3
+ FileDir = /Users/Hal/Dropbox/topx/git/livetext/test/snapshots/predef_vars
4
4
  User = Hal
5
5
  Version = 0.9.11
6
6
  NoSuchVar = [NoSuchVar is undefined]
@@ -0,0 +1,7 @@
1
+ EXPECTED | ACTUAL
2
+ Here we go... Here we go...
3
+ File = source.lt3 File = source.lt3
4
+ FileDir = /Users/Hal/Dropbox/topx/git/livetext/test/snapsho FileDir = /Users/Hal/Dropbox/topx/git/livetext/test/snapsho
5
+ User = Hal User = Hal
6
+ Version = 0.9.12 | Version = 0.9.11
7
+ NoSuchVar = [NoSuchVar is undefined] NoSuchVar = [NoSuchVar is undefined]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ Error: #<ArgumentError: wrong number of arguments (given 1, expected 0)>
2
+ Error: Name 'hello_world' is unknown
@@ -0,0 +1,4 @@
1
+ Here I am
2
+ testing a simple mixin
3
+ Now call a method:
4
+ That's all.
@@ -0,0 +1,6 @@
1
+ EXPECTED | ACTUAL
2
+ Here I am Here I am
3
+ testing a simple mixin testing a simple mixin
4
+ Now call a method: Now call a method:
5
+ > Hello, world.
6
+ That's all. That's all.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes