livetext 0.9.19 → 0.9.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +4 -2
  3. data/README.md +330 -339
  4. data/bin/livetext +0 -2
  5. data/imports/bookish.rb +8 -10
  6. data/imports/markdown.rb +6 -6
  7. data/imports/pyggish.rb +2 -34
  8. data/imports/tutorial.rb +4 -4
  9. data/lib/cmdargs.rb +30 -20
  10. data/lib/errors.rb +2 -0
  11. data/lib/formatline.rb +54 -124
  12. data/lib/funcall.rb +93 -0
  13. data/lib/functions.rb +17 -2
  14. data/lib/global_helpers.rb +39 -0
  15. data/lib/handler/import.rb +44 -0
  16. data/lib/handler.rb +3 -1
  17. data/lib/helpers.rb +46 -12
  18. data/lib/html.rb +2 -0
  19. data/lib/livetext.rb +34 -6
  20. data/lib/parser/file.rb +0 -2
  21. data/lib/parser/general.rb +1 -4
  22. data/lib/parser/mixin.rb +4 -8
  23. data/lib/parser/set.rb +3 -8
  24. data/lib/parser/string.rb +11 -10
  25. data/lib/parser.rb +2 -0
  26. data/lib/parsing.rb +31 -0
  27. data/lib/processor.rb +66 -60
  28. data/lib/standard.rb +28 -17
  29. data/lib/userapi.rb +8 -4
  30. data/plugin/bookish.rb +4 -5
  31. data/plugin/markdown.rb +6 -6
  32. data/plugin/pyggish.rb +46 -77
  33. data/plugin/tutorial.rb +3 -3
  34. data/test/snapshots/error_inc_line_num/OUT +17 -0
  35. data/test/snapshots/{icanhaz2/expected-error.txt → error_inc_line_num/actual-error.txt} +0 -0
  36. data/test/snapshots/error_inc_line_num/actual-output.txt +17 -0
  37. data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
  38. data/test/snapshots/error_invalid_name/actual-output.txt +0 -0
  39. data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
  40. data/test/snapshots/error_missing_end/actual-error.txt +10 -0
  41. data/test/snapshots/error_missing_end/actual-output.txt +0 -0
  42. data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
  43. data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
  44. data/test/snapshots/error_no_such_copy/actual-output.txt +0 -0
  45. data/test/snapshots/error_no_such_copy/match-error.txt +1 -1
  46. data/test/snapshots/error_no_such_copy/out-sdiff.txt +5 -0
  47. data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
  48. data/test/snapshots/error_no_such_inc/actual-output.txt +0 -0
  49. data/test/snapshots/error_no_such_inc/match-error.txt +1 -1
  50. data/test/snapshots/error_no_such_inc/out-sdiff.txt +6 -0
  51. data/test/snapshots/error_no_such_mixin/actual-error.txt +13 -0
  52. data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
  53. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +6 -0
  54. data/test/snapshots/{icanhaz → import}/expected-output.txt +0 -0
  55. data/test/snapshots/{icanhaz → import}/match-error.txt +0 -0
  56. data/test/snapshots/{icanhaz → import}/simple_import.rb +0 -0
  57. data/test/snapshots/{icanhaz → import}/source.lt3 +2 -2
  58. data/test/snapshots/import2/expected-error.txt +0 -0
  59. data/test/snapshots/{icanhaz2 → import2}/expected-output.txt +3 -1
  60. data/test/snapshots/{icanhaz2/simple_canhaz.rb → import2/simple_import.rb} +0 -0
  61. data/test/snapshots/import2/source.lt3 +8 -0
  62. data/test/snapshots/import_bookish/expected-error.txt +0 -0
  63. data/test/snapshots/import_bookish/expected-output.txt +10 -0
  64. data/test/snapshots/import_bookish/source.lt3 +7 -0
  65. data/test/snapshots/import_bookish/toc.tmp +0 -0
  66. data/test/snapshots/mixin_bookish/expected-error.txt +0 -0
  67. data/test/snapshots/mixin_bookish/expected-output.txt +10 -0
  68. data/test/snapshots/mixin_bookish/source.lt3 +7 -0
  69. data/test/snapshots/mixin_bookish/toc.tmp +0 -0
  70. data/test/snapshots/more_functions/expected-error.txt +0 -0
  71. data/test/snapshots/more_functions/expected-output.txt +37 -0
  72. data/test/snapshots/more_functions/source.lt3 +40 -0
  73. data/test/snapshots/simple_import/expected-output.txt +2 -0
  74. data/test/snapshots/simple_import/source.lt3 +3 -1
  75. data/test/snapshots/subset.txt +84 -0
  76. data/test/snapshots.rb +39 -43
  77. data/test/unit/formatline.rb +253 -134
  78. data/test/unit/html.rb +1 -1
  79. data/test/unit/parser/general.rb +1 -2
  80. data/test/unit/parser/mixin.rb +1 -3
  81. data/test/unit/parser/set.rb +22 -24
  82. data/test/unit/parser/string.rb +46 -7
  83. data/test/unit/parser.rb +0 -1
  84. data/test/unit/standard.rb +0 -1
  85. metadata +43 -24
  86. data/imports/markdown_importable.rb +0 -46
  87. data/lib/handler/icanhaz.rb +0 -35
  88. data/lib/livetext/importable.rb +0 -2
  89. data/lib/parser/import.rb +0 -15
  90. data/test/affirm/kbks.jpg +0 -0
  91. data/test/affirm/lm-kbks.lt +0 -19
  92. data/test/cleanup +0 -1
  93. data/test/newtest +0 -14
  94. data/test/sdtest +0 -6
  95. data/test/snapshots/OMIT.txt +0 -11
  96. data/test/snapshots/clusion.txt +0 -84
  97. data/test/snapshots/crap +0 -16
  98. data/test/snapshots/fixit +0 -6
  99. data/test/snapshots/icanhaz2/source.lt3 +0 -6
  100. data/test/unit/parser/importable.rb +0 -19
@@ -1,9 +1,9 @@
1
1
 
2
2
  require 'minitest/autorun'
3
3
 
4
- require_relative '../../../lib/parser/set'
4
+ require_relative '../parser' # nested
5
5
 
6
- ParseSet = Livetext::ParseSet
6
+ ParseSet = ::Livetext::ParseSet
7
7
 
8
8
  class TestParseSet < MiniTest::Test
9
9
 
@@ -13,7 +13,7 @@ class TestParseSet < MiniTest::Test
13
13
  def teardown
14
14
  end
15
15
 
16
- def ztest_one_unquoted
16
+ def test_one_unquoted
17
17
  set = ParseSet.new('my_var_123 = 789').parse
18
18
  pair = set.first
19
19
  assert_equal pair, %w[my_var_123 789]
@@ -23,38 +23,37 @@ class TestParseSet < MiniTest::Test
23
23
  assert_equal pair, %w[var_234 naked_string]
24
24
  end
25
25
 
26
- def ztest_one_single_quoted
26
+ def test_one_single_quoted
27
27
  set = ParseSet.new("fancy.var.name = 'simple string'").parse
28
28
  pair = set.first
29
29
  assert_equal pair, ["fancy.var.name", "simple string"]
30
30
  end
31
31
 
32
- def ztest_one_double_quoted
32
+ def test_one_double_quoted
33
33
  set = ParseSet.new('fancy.var2 = "another string"').parse
34
34
  pair = set.first
35
35
  assert_equal pair, ["fancy.var2", "another string"]
36
36
  end
37
37
 
38
- def ztest_multiple_unquoted
39
- puts __method__
38
+ def test_multiple_unquoted
40
39
  pair1, pair2 = ParseSet.new("this=345, that=678").parse
41
40
  assert_equal pair1, %w[this 345]
42
41
  assert_equal pair2, %w[that 678]
43
42
  end
44
43
 
45
- def ztest_multiple_unquoted_quoted
44
+ def test_multiple_unquoted_quoted
46
45
  pair1, pair2 = ParseSet.new('alpha = 567, beta = "oh well"').parse
47
46
  assert_equal pair1, %w[alpha 567]
48
47
  assert_equal pair2, ["beta", "oh well"]
49
48
  end
50
49
 
51
- def ztest_quote_embedded_comma
50
+ def test_quote_embedded_comma
52
51
  set = ParseSet.new('gamma = "oh, well"').parse
53
52
  pair = set.first
54
53
  assert_equal pair, ["gamma", "oh, well"]
55
54
  end
56
55
 
57
- def ztest_get_var
56
+ def test_get_var
58
57
  @parse = ParseSet.new("foo=345")
59
58
  assert_equal @parse.get_var, "foo"
60
59
  @parse = ParseSet.new("foo = 345")
@@ -79,7 +78,7 @@ puts __method__
79
78
  assert_raises(BadVariableName) { @parse.get_var }
80
79
  end
81
80
 
82
- def ztest_skip_equal
81
+ def test_skip_equal
83
82
  @parse = ParseSet.new("=")
84
83
  assert_nil @parse.skip_equal
85
84
  @parse = ParseSet.new(" = ")
@@ -97,7 +96,7 @@ puts __method__
97
96
  assert_raises(NoEqualSign) { @parse.skip_equal }
98
97
  end
99
98
 
100
- def ztest_quoted_value
99
+ def test_quoted_value
101
100
  @parse = ParseSet.new(%['this'])
102
101
  assert_equal @parse.quoted_value, "this"
103
102
  @parse = ParseSet.new(%["that"])
@@ -119,7 +118,7 @@ puts __method__
119
118
  # - allow (escaped?) comma in quoted string
120
119
  end
121
120
 
122
- def ztest_unquoted_value
121
+ def test_unquoted_value
123
122
  # Note: an unquoted value is still a string!
124
123
  @parse = ParseSet.new(%[342 ])
125
124
  assert_equal @parse.unquoted_value, "342"
@@ -138,27 +137,26 @@ puts __method__
138
137
  # - allow/disallow escaping??
139
138
  end
140
139
 
141
- # BUG: FormatLine doesn't know variables in this context!
142
-
143
- def xtest_4 # FIXME
140
+ def test_var_eq_var
144
141
  set = ParseSet.new("file = $File").parse
142
+ set = set.first # [["var", "value"]]
145
143
  assert_equal set.first, "file"
146
- assert set.last !~ /undefined/
144
+ assert set.last =~ /undefined/, "Found 'undefined' for variable value"
145
+ # ^ ParseSet isn't smart enough to know about variables/functions
147
146
  end
148
147
 
149
- # BUG: ...or functions.
150
- # (Additional bug: Failing silently seems wrong.)
151
-
152
- def xtest_5 # FIXME
148
+ def test_var_eq_func
153
149
  set = ParseSet.new("date = $$date").parse
150
+ set = set.first # [["var", "value"]]
154
151
  assert_equal set.first, "date"
155
- assert set.last =~ /^\d\d.\d\d.\d\d/
152
+ assert set.last =~ /undefined/, "Found 'undefined' for variable value"
153
+ # ^ ParseSet isn't smart enough to know about variables/functions
156
154
  end
157
155
 
158
156
  def test_two_strings
159
- line = %[bday="May_31", date="5/31"]
157
+ line = %[bday="May 31", date='5/31']
160
158
  set = ParseSet.new(line).parse
161
- assert set == [["bday", "May_31"], ["date", "5/31"]]
159
+ assert set == [["bday", "May 31"], ["date", "5/31"]]
162
160
  end
163
161
 
164
162
  end
@@ -1,6 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
 
3
- require_relative '../../../lib/parser/string'
3
+ require_relative '../parser' # nested
4
4
 
5
5
  class TestStringParser < MiniTest::Test
6
6
 
@@ -81,20 +81,16 @@ class TestStringParser < MiniTest::Test
81
81
  assert_nil char1
82
82
  assert_nil char2
83
83
  assert @zero.i == 0
84
- assert @zero.last?
85
84
  assert @zero.eos?
86
85
 
87
- refute @one.last? # FIXME??
88
86
  char1 = @one.peek
89
- refute @one.last? # FIXME??
90
87
  char2 = @one.grab
91
88
  char3 = @one.peek
92
89
  assert char1
93
90
  assert char2 == char1
94
91
  assert char3 == @str1[1]
95
92
  assert @one.i == 1
96
- assert @one.last?
97
- assert @one.eos? # FIXME??
93
+ assert @one.eos?
98
94
 
99
95
  char1 = @many.peek
100
96
  char2 = @many.grab
@@ -103,7 +99,6 @@ class TestStringParser < MiniTest::Test
103
99
  assert char2 == char1
104
100
  assert char3 == @strN[1]
105
101
  assert @many.i == 1
106
- refute @many.last?
107
102
  refute @many.eos?
108
103
  end
109
104
 
@@ -126,5 +121,49 @@ class TestStringParser < MiniTest::Test
126
121
  refute some.peek == " "
127
122
  assert_equal some.peek, "x"
128
123
  assert_equal some.i, 3
124
+
125
+ some = StringParser.new("abc 123")
126
+ 3.times { some.grab }
127
+ assert_equal some.peek, " "
128
+ some.skip_spaces
129
+ refute some.peek == " "
130
+ assert_equal some.peek, "1"
131
+ assert_equal some.i, 6
132
+ end
133
+
134
+ def test_ungrab
135
+ parse = StringParser.new("abcdef")
136
+ assert_equal parse.i, 0
137
+ assert_equal parse.peek, "a"
138
+ 3.times { parse.grab }
139
+ assert_equal parse.i, 3
140
+ assert_equal parse.peek, "d"
141
+ parse.ungrab
142
+ assert_equal parse.i, 2
143
+ assert_equal parse.peek, "c"
144
+ end
145
+
146
+ def test_lookahead
147
+ parse = StringParser.new("abcdef")
148
+ assert_equal parse.peek, "a"
149
+ assert_equal parse.lookahead, "b"
150
+ assert_equal parse.i, 0
151
+ 3.times { parse.grab }
152
+ before = parse.i
153
+ assert_equal parse.lookahead, "e"
154
+ after = parse.i
155
+ assert_equal before, after
156
+ end
157
+
158
+ def test_prev
159
+ parse = StringParser.new("abcdef")
160
+ assert_nil parse.prev
161
+ assert_equal parse.i, 0
162
+ 3.times { parse.grab }
163
+ before = parse.i
164
+ assert_equal parse.prev, "c"
165
+ after = parse.i
166
+ assert_equal before, after
129
167
  end
168
+
130
169
  end
data/test/unit/parser.rb CHANGED
@@ -3,4 +3,3 @@ require_relative 'parser/string'
3
3
  require_relative 'parser/set'
4
4
  require_relative 'parser/general'
5
5
  require_relative 'parser/mixin' # currently empty
6
- require_relative 'parser/importable' # currently empty
@@ -1,6 +1,5 @@
1
1
  require 'minitest/autorun'
2
2
 
3
-
4
3
  require_relative '../../lib/livetext'
5
4
 
6
5
  class TestingLivetext < MiniTest::Test
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.19
4
+ version: 0.9.23
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-10 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -24,26 +24,26 @@ files:
24
24
  - imports/calibre.rb
25
25
  - imports/livemagick.rb
26
26
  - imports/markdown.rb
27
- - imports/markdown_importable.rb
28
27
  - imports/pyggish.rb
29
28
  - imports/tutorial.rb
30
29
  - lib/cmdargs.rb
31
30
  - lib/errors.rb
32
31
  - lib/formatline.rb
32
+ - lib/funcall.rb
33
33
  - lib/functions.rb
34
+ - lib/global_helpers.rb
34
35
  - lib/handler.rb
35
- - lib/handler/icanhaz.rb
36
+ - lib/handler/import.rb
36
37
  - lib/helpers.rb
37
38
  - lib/html.rb
38
39
  - lib/livetext.rb
39
- - lib/livetext/importable.rb
40
40
  - lib/parser.rb
41
41
  - lib/parser/file.rb
42
42
  - lib/parser/general.rb
43
- - lib/parser/import.rb
44
43
  - lib/parser/mixin.rb
45
44
  - lib/parser/set.rb
46
45
  - lib/parser/string.rb
46
+ - lib/parsing.rb
47
47
  - lib/processor.rb
48
48
  - lib/standard.rb
49
49
  - lib/userapi.rb
@@ -54,21 +54,14 @@ files:
54
54
  - plugin/markdown.rb
55
55
  - plugin/pyggish.rb
56
56
  - plugin/tutorial.rb
57
- - test/affirm/kbks.jpg
58
- - test/affirm/lm-kbks.lt
59
57
  - test/all.rb
60
- - test/cleanup
61
- - test/newtest
62
- - test/sdtest
63
58
  - test/snapshots.rb
64
- - test/snapshots/OMIT.txt
65
59
  - test/snapshots/basic_formatting/expected-error.txt
66
60
  - test/snapshots/basic_formatting/expected-output.txt
67
61
  - test/snapshots/basic_formatting/source.lt3
68
62
  - test/snapshots/block_comment/expected-error.txt
69
63
  - test/snapshots/block_comment/expected-output.txt
70
64
  - test/snapshots/block_comment/source.lt3
71
- - test/snapshots/clusion.txt
72
65
  - test/snapshots/comments_ignored_1/expected-error.txt
73
66
  - test/snapshots/comments_ignored_1/expected-output.txt
74
67
  - test/snapshots/comments_ignored_1/source.lt3
@@ -76,16 +69,21 @@ files:
76
69
  - test/snapshots/copy_is_raw/expected-output.txt
77
70
  - test/snapshots/copy_is_raw/rawtext.inc
78
71
  - test/snapshots/copy_is_raw/source.lt3
79
- - test/snapshots/crap
80
72
  - test/snapshots/def_method/expected-error.txt
81
73
  - test/snapshots/def_method/expected-output.txt
82
74
  - 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
83
78
  - test/snapshots/error_inc_line_num/expected-output.txt
84
79
  - test/snapshots/error_inc_line_num/file2.lt3
85
80
  - test/snapshots/error_inc_line_num/match-error.txt
86
81
  - 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
87
84
  - test/snapshots/error_invalid_name/expected-output.txt
88
85
  - test/snapshots/error_invalid_name/match-error.txt
86
+ - test/snapshots/error_invalid_name/out-sdiff.txt
89
87
  - test/snapshots/error_invalid_name/source.lt3
90
88
  - test/snapshots/error_line_num/expected-output.txt
91
89
  - test/snapshots/error_line_num/match-error.txt
@@ -93,20 +91,32 @@ files:
93
91
  - test/snapshots/error_mismatched_end/expected-output.txt
94
92
  - test/snapshots/error_mismatched_end/match-error.txt
95
93
  - 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
96
  - test/snapshots/error_missing_end/expected-output.txt
97
97
  - test/snapshots/error_missing_end/match-error.txt
98
+ - test/snapshots/error_missing_end/out-sdiff.txt
98
99
  - test/snapshots/error_missing_end/source.lt3
99
100
  - test/snapshots/error_name_not_permitted/expected-output.txt
100
101
  - test/snapshots/error_name_not_permitted/match-error.txt
101
102
  - 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
102
105
  - test/snapshots/error_no_such_copy/expected-output.txt
103
106
  - test/snapshots/error_no_such_copy/match-error.txt
107
+ - test/snapshots/error_no_such_copy/out-sdiff.txt
104
108
  - 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
105
111
  - test/snapshots/error_no_such_inc/expected-output.txt
106
112
  - test/snapshots/error_no_such_inc/match-error.txt
113
+ - test/snapshots/error_no_such_inc/out-sdiff.txt
107
114
  - 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
108
117
  - test/snapshots/error_no_such_mixin/expected-output.txt
109
118
  - test/snapshots/error_no_such_mixin/match-error.txt
119
+ - test/snapshots/error_no_such_mixin/out-sdiff.txt
110
120
  - test/snapshots/error_no_such_mixin/source.lt3
111
121
  - test/snapshots/example_alpha/expected-error.txt
112
122
  - test/snapshots/example_alpha/expected-output.txt
@@ -114,24 +124,34 @@ files:
114
124
  - test/snapshots/example_alpha2/expected-error.txt
115
125
  - test/snapshots/example_alpha2/expected-output.txt
116
126
  - test/snapshots/example_alpha2/source.lt3
117
- - test/snapshots/fixit
118
127
  - test/snapshots/functions/expected-error.txt
119
128
  - test/snapshots/functions/expected-output.txt
120
129
  - test/snapshots/functions/source.lt3
121
130
  - test/snapshots/hello_world/expected-error.txt
122
131
  - test/snapshots/hello_world/expected-output.txt
123
132
  - test/snapshots/hello_world/source.lt3
124
- - test/snapshots/icanhaz/expected-output.txt
125
- - test/snapshots/icanhaz/match-error.txt
126
- - test/snapshots/icanhaz/simple_import.rb
127
- - test/snapshots/icanhaz/source.lt3
128
- - test/snapshots/icanhaz2/expected-error.txt
129
- - test/snapshots/icanhaz2/expected-output.txt
130
- - test/snapshots/icanhaz2/simple_canhaz.rb
131
- - test/snapshots/icanhaz2/source.lt3
133
+ - test/snapshots/import/expected-output.txt
134
+ - test/snapshots/import/match-error.txt
135
+ - test/snapshots/import/simple_import.rb
136
+ - test/snapshots/import/source.lt3
137
+ - test/snapshots/import2/expected-error.txt
138
+ - test/snapshots/import2/expected-output.txt
139
+ - test/snapshots/import2/simple_import.rb
140
+ - test/snapshots/import2/source.lt3
141
+ - test/snapshots/import_bookish/expected-error.txt
142
+ - test/snapshots/import_bookish/expected-output.txt
143
+ - test/snapshots/import_bookish/source.lt3
144
+ - test/snapshots/import_bookish/toc.tmp
145
+ - test/snapshots/mixin_bookish/expected-error.txt
146
+ - test/snapshots/mixin_bookish/expected-output.txt
147
+ - test/snapshots/mixin_bookish/source.lt3
148
+ - test/snapshots/mixin_bookish/toc.tmp
132
149
  - test/snapshots/more_complex_vars/expected-error.txt
133
150
  - test/snapshots/more_complex_vars/expected-output.txt
134
151
  - test/snapshots/more_complex_vars/source.lt3
152
+ - test/snapshots/more_functions/expected-error.txt
153
+ - test/snapshots/more_functions/expected-output.txt
154
+ - test/snapshots/more_functions/source.lt3
135
155
  - test/snapshots/predef_vars/expected-error.txt
136
156
  - test/snapshots/predef_vars/match-output.txt
137
157
  - test/snapshots/predef_vars/source.lt3
@@ -175,7 +195,6 @@ files:
175
195
  - test/unit/parser.rb
176
196
  - test/unit/parser/all.rb
177
197
  - test/unit/parser/general.rb
178
- - test/unit/parser/importable.rb
179
198
  - test/unit/parser/mixin.rb
180
199
  - test/unit/parser/set.rb
181
200
  - test/unit/parser/string.rb
@@ -1,46 +0,0 @@
1
- # This file is intended to be used via a Livetext .mixin
2
- # or the equivalent.
3
-
4
- require_relative '../lib/livetext/importable'
5
-
6
- class MarkdownImportable < LiveText::Importable
7
-
8
- SimpleFormats[:b] = %w[* *]
9
- SimpleFormats[:i] = %w[_ _]
10
- SimpleFormats[:t] = %w[` `]
11
- SimpleFormats[:s] = %w[<strike> </strike>]
12
-
13
- def h1; _out "# #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end # atx style for now
14
- def h2; _out "## #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end
15
- def h3; _out "### #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end
16
- def h4; _out "#### #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end
17
- def h5; _out "##### #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end
18
- def h6; _out "###### #{FormatLine.var_func_parse(@_data)}"; _optional_blank_line end
19
-
20
- def title
21
- h1
22
- end
23
-
24
- def section
25
- h3
26
- end
27
-
28
- def bq # block quote
29
- _body {|line| _out "> #{line}" }
30
- end
31
-
32
- def list
33
- _body {|line| _out " * #{line}" }
34
- end
35
-
36
- def olist # Doesn't handle paragraphs yet
37
- n = 0
38
- _body do |line|
39
- n += 1
40
- _out "#{n}. #{_format(line)}"
41
- end
42
- end
43
-
44
- alias nlist olist
45
- end
46
- end
@@ -1,35 +0,0 @@
1
-
2
- class Livetext::Handler::ICanHaz
3
- include Helpers
4
-
5
- attr_reader :file
6
-
7
- def initialize(name)
8
- @name = name
9
- @file = find_file(name)
10
- end
11
-
12
- def self.get_module(name)
13
- handler = self.new(name)
14
- const1 = Object.constants
15
- @file = handler.file.sub(/.rb$/, "")
16
- require @file # + ".rb"
17
- const2 = Object.constants
18
- names = (const2 - const1)
19
- abort "Expected ONE new constant: #{names.inspect}" if names.size != 1
20
- modname = names.first.to_s
21
- newmod = Object.const_get("::" + modname)
22
- newmod # return actual module
23
- end
24
-
25
- private
26
-
27
- def cwd_root?
28
- File.dirname(File.expand_path(".")) == "/"
29
- end
30
-
31
- def fname2module(name)
32
- end
33
-
34
- end
35
-
@@ -1,2 +0,0 @@
1
- class LiveText::Importable
2
- end
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
-
data/test/affirm/kbks.jpg DELETED
Binary file
@@ -1,19 +0,0 @@
1
- .mixin livemagick
2
-
3
- .nopass
4
-
5
- .image 300 100 lightgray
6
- .canvas green 1 0
7
- .pen red red
8
- .font 80 Arial
9
-
10
- .rectangle 100,50 300x300 green 9
11
-
12
- .text! 100,50 100x100
13
- K B K Z
14
- .end
15
- .draw
16
- .save! myfile.jpg
17
-
18
- .def foobar
19
-
data/test/cleanup DELETED
@@ -1 +0,0 @@
1
- find testfiles -name actual-*.txt | xargs rm
data/test/newtest DELETED
@@ -1,14 +0,0 @@
1
- mkdir test/data/$1
2
-
3
- # actual-error.txt actual-output.txt expected-error.txt expected-output.txt source.lt3
4
-
5
- cd test/data/$1
6
-
7
- touch expected-output.txt expected-error.txt
8
-
9
- vi source.lt3
10
-
11
- livetext source.lt3 >expected-output.txt 2>expected-error.txt
12
-
13
- vi -O source.lt3 expected-output.txt expected-error.txt
14
-
data/test/sdtest DELETED
@@ -1,6 +0,0 @@
1
-
2
- sdiff test/data/$1/expected-output.txt /tmp/$1--actual-output.txt
3
-
4
- echo ==========
5
-
6
- sdiff test/data/$1/expected-error.txt /tmp/$1--actual-error.txt
@@ -1,11 +0,0 @@
1
- # Comments are ignored.
2
- # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
3
- # fake_test_name Use # to un-omit ;)
4
- error_no_such_inc Output BEFORE error doesn't get passed through
5
- error_no_such_copy ^ Same behavior as error_no_such_inc
6
- error_no_such_mixin ^ Same behavior as error_missing_end
7
- error_invalid_name ^ Same behavior as error_no_such_inc
8
- error_missing_end Output is duplicated somehow. Look for: puts @body or puts @main.body
9
- error_inc_line_num Forgot what's wrong here
10
- simple_import Not coded yet
11
- icanhaz Dummy command similar to import/mixin
@@ -1,84 +0,0 @@
1
- # This file specifies which snapshots will/won't be run.
2
-
3
- # Blank lines and comments are ignored.
4
- # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
5
-
6
- # You can start by uncommenting one of these:
7
- # Default INCLUDE all
8
- # Default EXCLUDE all
9
- # If you use neither, INCLUDE is the default (but explicit is better)
10
-
11
- # If you include all, you can specify exclusions with an x:
12
- # x my_test_name # this is a comment
13
-
14
- # Likewise if you EXCLUDE all, you can specify inclusions with an i:
15
- # i some_other_test # this is a comment
16
-
17
- # The i and x (to include/exclude) must be the first token on
18
- # the line (preceding the test name)
19
-
20
- # Note that QUIT (on a line by itself) will stop processing the file
21
-
22
- x error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
23
- x error_no_such_copy # ^ Same behavior as error_no_such_inc
24
- x error_no_such_mixin # ^ Same behavior as error_missing_end
25
- x error_invalid_name # ^ Same behavior as error_no_such_inc
26
- x error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
27
- x error_inc_line_num # Forgot what's wrong here
28
-
29
- # Dummy command .icanhaz works like .mixin or .import
30
-
31
- x icanhaz # "Leading" output doesn't get generated (same as error_no_such_inc)
32
- icanhaz2
33
-
34
- # Others (usually passing):
35
-
36
- # import/include/mixin, others...
37
-
38
- simple_copy #
39
- simple_import #
40
- simple_include #
41
- simple_mixin #
42
-
43
- # raw input
44
-
45
- single_raw_line #
46
- raw_lines #
47
- raw_text_block #
48
- copy_is_raw #
49
-
50
- # comments
51
-
52
- block_comment #
53
- comments_ignored_1 #
54
-
55
- # variables and heredocs
56
-
57
- predef_vars #
58
- simple_vars #
59
- more_complex_vars #
60
- table_with_heredocs #
61
-
62
- # testing def
63
-
64
- def_method #
65
-
66
- # intraline formatting
67
-
68
- basic_formatting #
69
-
70
- # Errors
71
-
72
- error_line_num #
73
- error_mismatched_end #
74
- error_name_not_permitted #
75
-
76
- # functions
77
-
78
- functions #
79
-
80
- # More/misc...
81
-
82
- example_alpha #
83
- example_alpha2 #
84
- hello_world #
data/test/snapshots/crap DELETED
@@ -1,16 +0,0 @@
1
- ./fixit block_comment
2
- ./fixit comments_ignored_1
3
- ./fixit comments_ignored_2
4
- ./fixit copy_is_raw
5
- ./fixit def_method
6
- ./fixit example_alpha
7
- ./fixit example_alpha2
8
- ./fixit hello_world
9
- ./fixit more_complex_vars
10
- ./fixit raw_text_block
11
- ./fixit sigil_can_change
12
- ./fixit simple_copy
13
- ./fixit simple_include
14
- ./fixit simple_mixin
15
- ./fixit simple_vars
16
- ./fixit single_raw_line
data/test/snapshots/fixit DELETED
@@ -1,6 +0,0 @@
1
- cd $1
2
- mv $1.err actual-error.txt
3
- mv $1.erx expected-error.txt
4
- mv $1.exp expected-output.txt
5
- mv $1.lt3 source.lt3
6
- mv $1.out actual-output.txt