livetext 0.9.52 → 0.9.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/imports/bookish.rb +3 -3
  3. data/lib/livetext/ast/show_ast_clean.rb +10 -0
  4. data/lib/livetext/ast/show_ast_result.rb +60 -0
  5. data/lib/livetext/ast/show_raw_arrays.rb +13 -0
  6. data/lib/livetext/ast.rb +464 -0
  7. data/lib/livetext/ast_to_html.rb +32 -0
  8. data/lib/livetext/core.rb +110 -53
  9. data/lib/livetext/errors.rb +1 -0
  10. data/lib/livetext/expansion.rb +21 -21
  11. data/lib/livetext/formatter.rb +70 -200
  12. data/lib/livetext/formatter_component.rb +189 -0
  13. data/lib/livetext/function_registry.rb +163 -0
  14. data/lib/livetext/functions.rb +26 -0
  15. data/lib/livetext/handler/mixin.rb +53 -0
  16. data/lib/livetext/helpers.rb +33 -16
  17. data/lib/livetext/reopen.rb +2 -0
  18. data/lib/livetext/skeleton.rb +0 -3
  19. data/lib/livetext/standard.rb +120 -72
  20. data/lib/livetext/userapi.rb +20 -1
  21. data/lib/livetext/variable_manager.rb +78 -0
  22. data/lib/livetext/variables.rb +9 -1
  23. data/lib/livetext/version.rb +1 -1
  24. data/lib/livetext.rb +9 -3
  25. data/plugin/booktool.rb +14 -14
  26. data/plugin/lt3scriptor.rb +914 -0
  27. data/plugin/mixin_functions_class.rb +33 -0
  28. data/test/snapshots/complex_body/expected-error.txt +0 -0
  29. data/test/snapshots/complex_body/expected-output.txt +8 -0
  30. data/test/snapshots/complex_body/source.lt3 +19 -0
  31. data/test/snapshots/debug_command/expected-error.txt +0 -0
  32. data/test/snapshots/debug_command/expected-output.txt +1 -0
  33. data/test/snapshots/debug_command/source.lt3 +3 -0
  34. data/test/snapshots/def_parameters/expected-error.txt +0 -0
  35. data/test/snapshots/def_parameters/expected-output.txt +21 -0
  36. data/test/snapshots/def_parameters/source.lt3 +44 -0
  37. data/test/snapshots/error_missing_end/match-error.txt +1 -1
  38. data/test/snapshots/functions_reflection/expected-error.txt +0 -0
  39. data/test/snapshots/functions_reflection/expected-output.txt +27 -0
  40. data/test/snapshots/functions_reflection/source.lt3 +5 -0
  41. data/test/snapshots/mixin_functions_class/expected-error.txt +0 -0
  42. data/test/snapshots/mixin_functions_class/expected-output.txt +20 -0
  43. data/test/snapshots/mixin_functions_class/mixin_functions_class.rb +33 -0
  44. data/test/snapshots/mixin_functions_class/source.lt3 +17 -0
  45. data/test/snapshots/multiple_functions/expected-error.txt +0 -0
  46. data/test/snapshots/multiple_functions/expected-output.txt +5 -0
  47. data/test/snapshots/multiple_functions/source.lt3 +16 -0
  48. data/test/snapshots/nested_includes/expected-error.txt +0 -0
  49. data/test/snapshots/nested_includes/expected-output.txt +68 -0
  50. data/test/snapshots/nested_includes/level2.inc +34 -0
  51. data/test/snapshots/nested_includes/level3.inc +20 -0
  52. data/test/snapshots/nested_includes/source.lt3 +49 -0
  53. data/test/snapshots/parameter_handling/expected-error.txt +0 -0
  54. data/test/snapshots/parameter_handling/expected-output.txt +7 -0
  55. data/test/snapshots/parameter_handling/source.lt3 +10 -0
  56. data/test/snapshots/subset.txt +1 -0
  57. data/test/snapshots/system_info/expected-error.txt +0 -0
  58. data/test/snapshots/system_info/match-output.txt +18 -0
  59. data/test/snapshots/system_info/source.lt3 +16 -0
  60. data/test/unit/all.rb +7 -0
  61. data/test/unit/ast.rb +90 -0
  62. data/test/unit/ast_directives.rb +104 -0
  63. data/test/unit/ast_variables.rb +71 -0
  64. data/test/unit/core_methods.rb +317 -0
  65. data/test/unit/formatter.rb +84 -0
  66. data/test/unit/formatter_component.rb +84 -0
  67. data/test/unit/function_registry.rb +132 -0
  68. data/test/unit/mixin_functions_class.rb +131 -0
  69. data/test/unit/stringparser.rb +14 -32
  70. data/test/unit/variable_manager.rb +71 -0
  71. metadata +51 -5
  72. data/imports/markdown.rb +0 -44
  73. data/lib/livetext/processor.rb +0 -88
  74. data/plugin/markdown.rb +0 -43
@@ -0,0 +1,132 @@
1
+ require 'minitest/autorun'
2
+
3
+ require_relative '../../lib/livetext'
4
+
5
+ class TestingLivetextFunctionRegistry < Minitest::Test
6
+ def setup
7
+ @live = Livetext.new
8
+ end
9
+
10
+ def check_match(exp, actual)
11
+ if exp.is_a? Regexp
12
+ assert_match(exp, actual, "actual does not match expected")
13
+ else
14
+ assert_equal(exp, actual, "actual != expected")
15
+ end
16
+ end
17
+
18
+ def test_registry_builtin_functions
19
+ # Test that builtin functions work through the registry
20
+ src = "$$date"
21
+ exp = /^\d{4}-\d{2}-\d{2}$/
22
+ actual = @live.api.format(src)
23
+ check_match(exp, actual)
24
+ end
25
+
26
+ def test_registry_user_functions
27
+ # Test that user functions are registered and work
28
+ registry = @live.function_registry
29
+
30
+ # Register a test function
31
+ registry.register_user('testfunc', ->(param) { param.upcase }, source: :inline, filename: 'test.lt3')
32
+
33
+ # Test that it works
34
+ result = registry.call('testfunc', 'hello')
35
+ assert_equal('HELLO', result)
36
+ end
37
+
38
+ def test_registry_function_override
39
+ # Test that user functions override builtin functions
40
+ registry = @live.function_registry
41
+
42
+ # Register a user function that should override the builtin
43
+ registry.register_user('reverse', ->(param) { param.upcase }, source: :inline, filename: 'test.lt3')
44
+
45
+ # Test that user function is called, not builtin
46
+ result = registry.call('reverse', 'hello')
47
+ assert_equal('HELLO', result) # User function (uppercase), not builtin (reverse)
48
+ end
49
+
50
+ def test_registry_function_listing
51
+ # Test that we can list functions
52
+ registry = @live.function_registry
53
+ functions = registry.list_functions
54
+
55
+ # Should have builtin functions
56
+ builtin_names = functions.select { |f| f[:source] == "builtin" }.map { |f| f[:name] }
57
+ assert_includes(builtin_names, "date")
58
+ assert_includes(builtin_names, "time")
59
+ assert_includes(builtin_names, "reverse")
60
+ end
61
+
62
+ def test_registry_error_handling
63
+ # Test error handling for non-existent functions
64
+ src = "$$nonexistent[param]"
65
+ exp = /Error evaluating/
66
+ actual = @live.api.format(src)
67
+ check_match(exp, actual)
68
+ end
69
+
70
+
71
+
72
+ def test_registry_function_source_tracking
73
+ # Test that function sources are tracked correctly
74
+ registry = @live.function_registry
75
+
76
+ # Register a test function
77
+ registry.register_user('testsource', ->(param) { "test" }, source: :inline, filename: 'test.lt3')
78
+
79
+ # Check that it's listed with correct source
80
+ functions = registry.list_functions
81
+ test_func = functions.find { |f| f[:name] == 'testsource' }
82
+ assert_equal("inline (test.lt3)", test_func[:source])
83
+ end
84
+
85
+ def test_registry_function_info
86
+ # Test getting detailed function information
87
+ registry = @live.function_registry
88
+
89
+ # Test builtin function info
90
+ info = registry.get_function_info('date')
91
+ assert_equal('date', info[:name])
92
+ assert_equal('builtin', info[:source])
93
+ assert_equal('builtin', info[:filename])
94
+ assert_equal(:builtin, info[:type])
95
+
96
+ # Test non-existent function
97
+ info = registry.get_function_info('nonexistent')
98
+ assert_nil(info)
99
+ end
100
+
101
+ def test_registry_mixin_source_tracking
102
+ # Test that mixin functions are tracked with correct source
103
+ registry = @live.function_registry
104
+
105
+ # Register a mixin function
106
+ registry.register_user('mixinfunc', ->(param) { "mixin" }, source: :mixin, filename: 'test_mixin.rb')
107
+
108
+ # Check that it's listed with correct source
109
+ functions = registry.list_functions
110
+ mixin_func = functions.find { |f| f[:name] == 'mixinfunc' }
111
+ assert_equal("mixin (test_mixin.rb)", mixin_func[:source])
112
+ end
113
+
114
+ def test_registry_function_exists
115
+ # Test the function_exists? method
116
+ registry = @live.function_registry
117
+
118
+ assert(registry.function_exists?('date'), "Builtin function should exist")
119
+ assert(registry.function_exists?('time'), "Builtin function should exist")
120
+ refute(registry.function_exists?('nonexistent'), "Non-existent function should not exist")
121
+ end
122
+
123
+ def test_registry_backward_compatibility
124
+ # Test that old-style function calls still work
125
+ src = "$$date"
126
+ exp = /^\d{4}-\d{2}-\d{2}$/
127
+ actual = @live.api.format(src)
128
+ check_match(exp, actual)
129
+ end
130
+
131
+
132
+ end
@@ -0,0 +1,131 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../../lib/livetext'
3
+
4
+ class TestingMixinFunctionsClass < Minitest::Test
5
+ def setup
6
+ @live = Livetext.new
7
+ end
8
+
9
+ def test_mixin_registers_functions_from_class
10
+ # Test that the mixin handler properly registers functions from Livetext::Functions class
11
+
12
+ # First, verify that our test functions don't exist yet
13
+ registry = @live.function_registry
14
+ assert_nil(registry.get_function_info('class_func'))
15
+ assert_nil(registry.get_function_info('another_class_func'))
16
+ assert_nil(registry.get_function_info('simple_class_func'))
17
+
18
+ # Load the mixin by calling the method directly
19
+ @live.mixin(['mixin_functions_class'], '')
20
+
21
+ # Now verify that the functions are registered
22
+ info = registry.get_function_info('class_func')
23
+ assert_equal('class_func', info[:name])
24
+ assert_equal('mixin (/Users/Hal/Dropbox/topx/git/livetext/plugin/mixin_functions_class.rb)', info[:source])
25
+ assert_equal(:user, info[:type])
26
+
27
+ info = registry.get_function_info('another_class_func')
28
+ assert_equal('another_class_func', info[:name])
29
+ assert_equal('mixin (/Users/Hal/Dropbox/topx/git/livetext/plugin/mixin_functions_class.rb)', info[:source])
30
+
31
+ info = registry.get_function_info('simple_class_func')
32
+ assert_equal('simple_class_func', info[:name])
33
+ assert_equal('mixin (/Users/Hal/Dropbox/topx/git/livetext/plugin/mixin_functions_class.rb)', info[:source])
34
+ end
35
+
36
+ def test_mixin_functions_work_properly
37
+ # Test that the registered functions actually work
38
+
39
+ # Load the mixin
40
+ @live.mixin(['mixin_functions_class'], '')
41
+
42
+ # Test function calls
43
+ result = @live.api.format("$$class_func:test_param")
44
+ assert_equal("Class function called with: test_param", result)
45
+
46
+ result = @live.api.format("$$another_class_func[with brackets]")
47
+ assert_equal("Another class function called with: with brackets", result)
48
+
49
+ result = @live.api.format("$$simple_class_func")
50
+ assert_equal("Simple class function with no parameters", result)
51
+ end
52
+
53
+ def test_mixin_functions_have_vars_access
54
+ # Test that functions in Livetext::Functions class have access to Livetext::Vars
55
+
56
+ # Set a variable using the better instance-based approach
57
+ @live.vars.set(:View, "test_view")
58
+
59
+ # Load the mixin
60
+ @live.mixin(['mixin_functions_class'], '')
61
+
62
+ # Test function that accesses vars
63
+ result = @live.api.format("$$vars_test:some_value")
64
+ assert_equal("Vars test: param=some_value, View=test_view", result)
65
+ end
66
+
67
+ def test_mixin_does_not_register_builtin_functions
68
+ # Test that the mixin handler doesn't re-register builtin functions
69
+
70
+ # Load the mixin
71
+ @live.mixin(['mixin_functions_class'], '')
72
+
73
+ # Check that builtin functions still have correct source
74
+ registry = @live.function_registry
75
+ info = registry.get_function_info('date')
76
+ assert_equal('builtin', info[:source]) # Should still be builtin, not mixin
77
+
78
+ info = registry.get_function_info('reverse')
79
+ assert_equal('builtin', info[:source]) # Should still be builtin, not mixin
80
+ end
81
+
82
+ def test_mixin_registers_both_module_and_class_functions
83
+ # Test that mixin handler registers both module methods and Livetext::Functions methods
84
+
85
+ # Create a test mixin file with both types
86
+ test_mixin_content = <<~RUBY
87
+ def module_func(param)
88
+ "Module function: \#{param}"
89
+ end
90
+
91
+ class Livetext::Functions
92
+ def class_func(param)
93
+ "Class function: \#{param}"
94
+ end
95
+ end
96
+ RUBY
97
+
98
+ # Write temporary test file in current directory
99
+ test_file = File.join(Dir.pwd, "temp_mixin_test.rb")
100
+ File.write(test_file, test_mixin_content)
101
+
102
+ begin
103
+ # Load the mixin
104
+ @live.mixin(['temp_mixin_test'], '')
105
+
106
+ # Test that both types of functions are registered
107
+ registry = @live.function_registry
108
+
109
+ # Module function should be registered
110
+ info = registry.get_function_info('module_func')
111
+ assert_equal('module_func', info[:name])
112
+ assert_equal("mixin (./temp_mixin_test.rb)", info[:source])
113
+
114
+ # Class function should be registered
115
+ info = registry.get_function_info('class_func')
116
+ assert_equal('class_func', info[:name])
117
+ assert_equal("mixin (./temp_mixin_test.rb)", info[:source])
118
+
119
+ # Both should work
120
+ result = @live.api.format("$$module_func:test")
121
+ assert_equal("Module function: test", result)
122
+
123
+ result = @live.api.format("$$class_func:test")
124
+ assert_equal("Class function: test", result)
125
+
126
+ ensure
127
+ # Clean up
128
+ File.delete(test_file) if File.exist?(test_file)
129
+ end
130
+ end
131
+ end
@@ -1,8 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
 
3
-
4
-
5
- require_relative '../../lib/stringparser'
3
+ require_relative '../../lib/livetext/parser/string'
6
4
 
7
5
  class TestStringParser < Minitest::Test
8
6
 
@@ -38,13 +36,13 @@ class TestStringParser < Minitest::Test
38
36
  end
39
37
 
40
38
  def test_next
41
- assert_nil @zero.next
39
+ assert_nil @zero.grab
42
40
  assert_equal @zero.i, 0 # nothing happens
43
41
 
44
- assert_equal @one.next, "x"
42
+ assert_equal @one.grab, "x"
45
43
  assert_equal @one.i, 1
46
44
 
47
- assert_equal @many.next, "T"
45
+ assert_equal @many.grab, "T"
48
46
  refute @many.eos, "EOS was true for #{@many.inspect}"
49
47
  assert_equal @many.i, 1
50
48
  end
@@ -56,20 +54,20 @@ class TestStringParser < Minitest::Test
56
54
  end
57
55
 
58
56
  def test_next_eos
59
- @zero.next
57
+ @zero.grab
60
58
  assert @zero.eos?
61
59
 
62
60
  @one.eos?
63
61
  refute @one.eos?
64
- @one.next
62
+ @one.grab
65
63
  assert @one.eos?
66
- @one.next # One beyond the actual end
64
+ @one.grab # One beyond the actual end
67
65
  assert @one.eos? # Still the end
68
66
 
69
- @many.next
67
+ @many.grab
70
68
  refute @many.eos?
71
69
  count = @many.len # doesn't make sense??
72
- count.times { @many.next }
70
+ count.times { @many.grab }
73
71
  assert @many.eos?
74
72
  end
75
73
 
@@ -80,36 +78,20 @@ class TestStringParser < Minitest::Test
80
78
  end
81
79
 
82
80
  def test_next_peek
83
- char1 = @zero.next
81
+ char1 = @zero.grab
84
82
  char2 = @zero.peek
85
83
  assert_nil char1
86
84
  assert_nil char2
87
85
  assert @zero.i == 0
88
- assert @zero.last?
89
86
  assert @zero.eos?
90
87
 
91
- refute @one.last?
92
88
  char1 = @one.peek
93
- refute @one.last?
94
- char2 = @one.next
95
- assert @one.last? # One beyond the last
89
+ char2 = @one.grab
96
90
  char3 = @one.peek
97
91
  assert char1
98
92
  assert char2 == char1
99
93
  assert char3 == @str1[1]
100
94
  assert @one.i == 1
101
- assert @one.last?
102
- assert @one.eos?
103
-
104
- char1 = @many.peek
105
- char2 = @many.next
106
- char3 = @many.peek
107
- assert char1
108
- assert char2 == char1
109
- assert char3 == @strN[1]
110
- assert @many.i == 1
111
- refute @many.last?
112
- refute @many.eos?
113
95
  end
114
96
 
115
97
  def test_skip_spaces
@@ -135,8 +117,8 @@ class TestStringParser < Minitest::Test
135
117
 
136
118
  def test_for_parse_set
137
119
  str = StringParser.new('gamma = "oh, well"')
138
- count = str.len # doesn't make sense??
139
- count.times { print str.next; }
140
-
120
+ count = str.len
121
+ count.times { str.grab }
122
+ assert str.eos?
141
123
  end
142
124
  end
@@ -0,0 +1,71 @@
1
+ require 'minitest/autorun'
2
+
3
+ require_relative '../../lib/livetext'
4
+
5
+ class TestingLivetextVariableManager < Minitest::Test
6
+ def setup
7
+ @live = Livetext.new
8
+ end
9
+
10
+ def test_variable_manager_initialization
11
+ # Test that VariableManager is properly initialized
12
+ assert(@live.variables, "VariableManager should be initialized")
13
+ assert_instance_of(Livetext::VariableManager, @live.variables)
14
+ end
15
+
16
+ def test_default_variables
17
+ # Test that default variables are set
18
+ assert_equal(`whoami`.chomp, @live.variables.get(:User))
19
+ assert_equal(Livetext::VERSION, @live.variables.get(:Version))
20
+ assert_equal(`hostname`.chomp, @live.variables.get(:Hostname))
21
+ assert_equal(RUBY_PLATFORM, @live.variables.get(:Platform))
22
+ assert_equal(RUBY_VERSION, @live.variables.get(:RubyVersion))
23
+ assert_equal(Livetext::VERSION, @live.variables.get(:LivetextVersion))
24
+ end
25
+
26
+ def test_date_time_variables
27
+ # Test that date/time variables are set
28
+ now = Time.now
29
+ assert_equal(now.year.to_s, @live.variables.get(:Year))
30
+ assert_equal(now.mon.to_s, @live.variables.get(:Month))
31
+ assert_equal(now.day.to_s, @live.variables.get(:Day))
32
+ assert_equal(now.hour.to_s, @live.variables.get(:Hour))
33
+ assert_equal(now.min.to_s, @live.variables.get(:Minute))
34
+ assert_equal(now.sec.to_s, @live.variables.get(:Second))
35
+ assert_equal(now.wday.to_s, @live.variables.get(:Weekday))
36
+ assert_equal(now.strftime("%U"), @live.variables.get(:Week))
37
+ end
38
+
39
+ def test_set_and_get_variables
40
+ # Test setting and getting custom variables
41
+ @live.variables.set(:test_var, "test_value")
42
+ assert_equal("test_value", @live.variables.get(:test_var))
43
+ end
44
+
45
+ def test_set_multiple_variables
46
+ # Test setting multiple variables at once
47
+ pairs = { var1: "value1", var2: "value2" }
48
+ @live.variables.set_multiple(pairs)
49
+ assert_equal("value1", @live.variables.get(:var1))
50
+ assert_equal("value2", @live.variables.get(:var2))
51
+ end
52
+
53
+ def test_variable_exists
54
+ # Test checking if variables exist
55
+ @live.variables.set(:exists_test, "value")
56
+ assert(@live.variables.exists?(:exists_test))
57
+ refute(@live.variables.exists?(:nonexistent))
58
+ end
59
+
60
+ def test_bracket_access
61
+ # Test bracket notation access
62
+ @live.variables.set(:bracket_test, "bracket_value")
63
+ assert_equal("bracket_value", @live.variables[:bracket_test])
64
+ end
65
+
66
+ def test_backward_compatibility
67
+ # Test that the old vars interface still works
68
+ assert(@live.vars, "vars method should still work")
69
+ assert_equal(`whoami`.chomp, @live.vars.get(:User))
70
+ end
71
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.52
4
+ version: 0.9.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-06 00:00:00.000000000 Z
10
+ date: 2025-08-08 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: A smart text processor extensible in Ruby
13
13
  email: rubyhacker@gmail.com
@@ -22,14 +22,20 @@ files:
22
22
  - imports/bookish.rb
23
23
  - imports/calibre.rb
24
24
  - imports/livemagick.rb
25
- - imports/markdown.rb
26
25
  - imports/pyggish.rb
27
26
  - imports/tutorial.rb
28
27
  - lib/livetext.rb
28
+ - lib/livetext/ast.rb
29
+ - lib/livetext/ast/show_ast_clean.rb
30
+ - lib/livetext/ast/show_ast_result.rb
31
+ - lib/livetext/ast/show_raw_arrays.rb
32
+ - lib/livetext/ast_to_html.rb
29
33
  - lib/livetext/core.rb
30
34
  - lib/livetext/errors.rb
31
35
  - lib/livetext/expansion.rb
32
36
  - lib/livetext/formatter.rb
37
+ - lib/livetext/formatter_component.rb
38
+ - lib/livetext/function_registry.rb
33
39
  - lib/livetext/functions.rb
34
40
  - lib/livetext/global_helpers.rb
35
41
  - lib/livetext/handler.rb
@@ -43,11 +49,11 @@ files:
43
49
  - lib/livetext/parser/string.rb
44
50
  - lib/livetext/parsing.rb
45
51
  - lib/livetext/paths.rb
46
- - lib/livetext/processor.rb
47
52
  - lib/livetext/reopen.rb
48
53
  - lib/livetext/skeleton.rb
49
54
  - lib/livetext/standard.rb
50
55
  - lib/livetext/userapi.rb
56
+ - lib/livetext/variable_manager.rb
51
57
  - lib/livetext/variables.rb
52
58
  - lib/livetext/version.rb
53
59
  - livetext.gemspec
@@ -55,8 +61,9 @@ files:
55
61
  - plugin/bootstrap_menu.rb
56
62
  - plugin/codetool.rb
57
63
  - plugin/livemagick.rb
58
- - plugin/markdown.rb
64
+ - plugin/lt3scriptor.rb
59
65
  - plugin/misc/navbar.rb
66
+ - plugin/mixin_functions_class.rb
60
67
  - plugin/tutorial.rb
61
68
  - test/all.rb
62
69
  - test/extra/README.txt
@@ -76,13 +83,22 @@ files:
76
83
  - test/snapshots/comments_ignored_1/expected-error.txt
77
84
  - test/snapshots/comments_ignored_1/expected-output.txt
78
85
  - test/snapshots/comments_ignored_1/source.lt3
86
+ - test/snapshots/complex_body/expected-error.txt
87
+ - test/snapshots/complex_body/expected-output.txt
88
+ - test/snapshots/complex_body/source.lt3
79
89
  - test/snapshots/copy_is_raw/expected-error.txt
80
90
  - test/snapshots/copy_is_raw/expected-output.txt
81
91
  - test/snapshots/copy_is_raw/rawtext.inc
82
92
  - test/snapshots/copy_is_raw/source.lt3
93
+ - test/snapshots/debug_command/expected-error.txt
94
+ - test/snapshots/debug_command/expected-output.txt
95
+ - test/snapshots/debug_command/source.lt3
83
96
  - test/snapshots/def_method/expected-error.txt
84
97
  - test/snapshots/def_method/expected-output.txt
85
98
  - test/snapshots/def_method/source.lt3
99
+ - test/snapshots/def_parameters/expected-error.txt
100
+ - test/snapshots/def_parameters/expected-output.txt
101
+ - test/snapshots/def_parameters/source.lt3
86
102
  - test/snapshots/error_inc_line_num/expected-output.txt
87
103
  - test/snapshots/error_inc_line_num/file2.lt3
88
104
  - test/snapshots/error_inc_line_num/match-error.txt
@@ -120,6 +136,9 @@ files:
120
136
  - test/snapshots/functions/expected-error.txt
121
137
  - test/snapshots/functions/expected-output.txt
122
138
  - test/snapshots/functions/source.lt3
139
+ - test/snapshots/functions_reflection/expected-error.txt
140
+ - test/snapshots/functions_reflection/expected-output.txt
141
+ - test/snapshots/functions_reflection/source.lt3
123
142
  - test/snapshots/hello_world/expected-error.txt
124
143
  - test/snapshots/hello_world/expected-output.txt
125
144
  - test/snapshots/hello_world/source.lt3
@@ -143,12 +162,27 @@ files:
143
162
  - test/snapshots/mixin_functions/expected-output.txt
144
163
  - test/snapshots/mixin_functions/mixin_functions.rb
145
164
  - test/snapshots/mixin_functions/source.lt3
165
+ - test/snapshots/mixin_functions_class/expected-error.txt
166
+ - test/snapshots/mixin_functions_class/expected-output.txt
167
+ - test/snapshots/mixin_functions_class/mixin_functions_class.rb
168
+ - test/snapshots/mixin_functions_class/source.lt3
146
169
  - test/snapshots/more_complex_vars/expected-error.txt
147
170
  - test/snapshots/more_complex_vars/expected-output.txt
148
171
  - test/snapshots/more_complex_vars/source.lt3
149
172
  - test/snapshots/more_functions/expected-error.txt
150
173
  - test/snapshots/more_functions/expected-output.txt
151
174
  - test/snapshots/more_functions/source.lt3
175
+ - test/snapshots/multiple_functions/expected-error.txt
176
+ - test/snapshots/multiple_functions/expected-output.txt
177
+ - test/snapshots/multiple_functions/source.lt3
178
+ - test/snapshots/nested_includes/expected-error.txt
179
+ - test/snapshots/nested_includes/expected-output.txt
180
+ - test/snapshots/nested_includes/level2.inc
181
+ - test/snapshots/nested_includes/level3.inc
182
+ - test/snapshots/nested_includes/source.lt3
183
+ - test/snapshots/parameter_handling/expected-error.txt
184
+ - test/snapshots/parameter_handling/expected-output.txt
185
+ - test/snapshots/parameter_handling/source.lt3
152
186
  - test/snapshots/predef_vars/expected-error.txt
153
187
  - test/snapshots/predef_vars/match-output.txt
154
188
  - test/snapshots/predef_vars/source.lt3
@@ -182,6 +216,9 @@ files:
182
216
  - test/snapshots/single_raw_line/expected-output.txt
183
217
  - test/snapshots/single_raw_line/source.lt3
184
218
  - test/snapshots/subset.txt
219
+ - test/snapshots/system_info/expected-error.txt
220
+ - test/snapshots/system_info/match-output.txt
221
+ - test/snapshots/system_info/source.lt3
185
222
  - test/snapshots/table_with_heredocs/expected-error.txt
186
223
  - test/snapshots/table_with_heredocs/expected-output.txt
187
224
  - test/snapshots/table_with_heredocs/old-exp-out.txt
@@ -191,10 +228,18 @@ files:
191
228
  - test/snapshots/var_into_func/source.lt3
192
229
  - test/test_escape.lt3
193
230
  - test/unit/all.rb
231
+ - test/unit/ast.rb
232
+ - test/unit/ast_directives.rb
233
+ - test/unit/ast_variables.rb
194
234
  - test/unit/bracketed.rb
235
+ - test/unit/core_methods.rb
195
236
  - test/unit/double.rb
237
+ - test/unit/formatter.rb
238
+ - test/unit/formatter_component.rb
239
+ - test/unit/function_registry.rb
196
240
  - test/unit/functions.rb
197
241
  - test/unit/html.rb
242
+ - test/unit/mixin_functions_class.rb
198
243
  - test/unit/parser.rb
199
244
  - test/unit/parser/all.rb
200
245
  - test/unit/parser/general.rb
@@ -204,6 +249,7 @@ files:
204
249
  - test/unit/single.rb
205
250
  - test/unit/standard.rb
206
251
  - test/unit/stringparser.rb
252
+ - test/unit/variable_manager.rb
207
253
  - test/unit/variables.rb
208
254
  homepage: https://github.com/Hal9000/livetext
209
255
  licenses:
data/imports/markdown.rb DELETED
@@ -1,44 +0,0 @@
1
- # This file is intended to be used via a Livetext .mixin
2
- # or the equivalent.
3
-
4
- module Markdown
5
- SimpleFormats = {}
6
- SimpleFormats[:b] = %w[* *]
7
- SimpleFormats[:i] = %w[_ _]
8
- SimpleFormats[:t] = %w[` `]
9
- SimpleFormats[:s] = %w[<strike> </strike>]
10
-
11
-
12
- def h1(args = nil, body = nil); api.out "# #{Livetext.interpolate(api.data)}"; api.optional_blank_line end # atx style for now
13
- def h2(args = nil, body = nil); api.out "## #{Livetext.interpolate(api.data)}"; api.optional_blank_line end
14
- def h3(args = nil, body = nil); api.out "### #{Livetext.interpolate(api.data)}"; api.optional_blank_line end
15
- def h4(args = nil, body = nil); api.out "#### #{Livetext.interpolate(api.data)}"; api.optional_blank_line end
16
- def h5(args = nil, body = nil); api.out "##### #{Livetext.interpolate(api.data)}"; api.optional_blank_line end
17
- def h6(args = nil, body = nil); api.out "###### #{Livetext.interpolate(api.data)}"; api.optional_blank_line end
18
-
19
- def title(args = nil, body = nil)
20
- h1
21
- end
22
-
23
- def section(args = nil, body = nil)
24
- h3
25
- end
26
-
27
- def bq(args = nil, body = nil) # block quote
28
- api.body {|line| api.out "> #{line}" }
29
- end
30
-
31
- def list(args = nil, body = nil)
32
- api.body {|line| api.out " * #{line}" }
33
- end
34
-
35
- def olist(args = nil, body = nil) # Doesn't handle paragraphs yet
36
- n = 0
37
- api.body do |line|
38
- n += 1
39
- api.out "#{n}. #{_format(line)}"
40
- end
41
- end
42
-
43
- alias nlist olist
44
- end