temple 0.8.2 → 0.10.2
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.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +35 -0
- data/.gitignore +1 -0
- data/CHANGES +34 -1
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/Rakefile +4 -11
- data/lib/temple/engine.rb +1 -0
- data/lib/temple/erb/engine.rb +3 -0
- data/lib/temple/erb/parser.rb +2 -1
- data/lib/temple/erb/template.rb +1 -0
- data/lib/temple/erb/trimming.rb +1 -0
- data/lib/temple/exceptions.rb +1 -0
- data/lib/temple/filter.rb +1 -0
- data/lib/temple/filters/ambles.rb +22 -0
- data/lib/temple/filters/code_merger.rb +1 -0
- data/lib/temple/filters/control_flow.rb +1 -0
- data/lib/temple/filters/dynamic_inliner.rb +2 -1
- data/lib/temple/filters/encoding.rb +1 -0
- data/lib/temple/filters/eraser.rb +1 -0
- data/lib/temple/filters/escapable.rb +1 -0
- data/lib/temple/filters/multi_flattener.rb +1 -0
- data/lib/temple/filters/remove_bom.rb +1 -0
- data/lib/temple/filters/static_analyzer.rb +1 -0
- data/lib/temple/filters/static_merger.rb +1 -0
- data/lib/temple/filters/string_splitter.rb +13 -1
- data/lib/temple/filters/validator.rb +1 -0
- data/lib/temple/generator.rb +5 -2
- data/lib/temple/generators/array.rb +1 -0
- data/lib/temple/generators/array_buffer.rb +1 -0
- data/lib/temple/generators/erb.rb +1 -0
- data/lib/temple/generators/rails_output_buffer.rb +4 -4
- data/lib/temple/generators/string_buffer.rb +2 -1
- data/lib/temple/grammar.rb +1 -0
- data/lib/temple/html/attribute_merger.rb +1 -0
- data/lib/temple/html/attribute_remover.rb +1 -0
- data/lib/temple/html/attribute_sorter.rb +1 -0
- data/lib/temple/html/dispatcher.rb +1 -0
- data/lib/temple/html/fast.rb +1 -0
- data/lib/temple/html/filter.rb +1 -0
- data/lib/temple/html/pretty.rb +1 -0
- data/lib/temple/html/safe.rb +1 -0
- data/lib/temple/map.rb +1 -0
- data/lib/temple/mixins/dispatcher.rb +1 -0
- data/lib/temple/mixins/engine_dsl.rb +1 -0
- data/lib/temple/mixins/grammar_dsl.rb +4 -2
- data/lib/temple/mixins/options.rb +1 -0
- data/lib/temple/mixins/template.rb +1 -0
- data/lib/temple/parser.rb +1 -0
- data/lib/temple/static_analyzer.rb +1 -0
- data/lib/temple/templates/rails.rb +7 -2
- data/lib/temple/templates/tilt.rb +2 -9
- data/lib/temple/templates.rb +1 -0
- data/lib/temple/utils.rb +5 -15
- data/lib/temple/version.rb +2 -1
- data/lib/temple.rb +2 -0
- data/spec/engine_spec.rb +189 -0
- data/{test/test_erb.rb → spec/erb_spec.rb} +12 -12
- data/spec/filter_spec.rb +29 -0
- data/{test/filters/test_code_merger.rb → spec/filters/code_merger_spec.rb} +7 -7
- data/{test/filters/test_control_flow.rb → spec/filters/control_flow_spec.rb} +13 -13
- data/{test/filters/test_dynamic_inliner.rb → spec/filters/dynamic_inliner_spec.rb} +18 -18
- data/{test/filters/test_eraser.rb → spec/filters/eraser_spec.rb} +9 -9
- data/{test/filters/test_escapable.rb → spec/filters/escapable_spec.rb} +10 -10
- data/{test/filters/test_multi_flattener.rb → spec/filters/multi_flattener_spec.rb} +4 -4
- data/{test/filters/test_static_analyzer.rb → spec/filters/static_analyzer_spec.rb} +6 -8
- data/{test/filters/test_static_merger.rb → spec/filters/static_merger_spec.rb} +7 -7
- data/spec/filters/string_splitter_spec.rb +50 -0
- data/spec/generator_spec.rb +179 -0
- data/spec/grammar_spec.rb +47 -0
- data/{test/html/test_attribute_merger.rb → spec/html/attribute_merger_spec.rb} +11 -11
- data/{test/html/test_attribute_remover.rb → spec/html/attribute_remover_spec.rb} +7 -7
- data/{test/html/test_attribute_sorter.rb → spec/html/attribute_sorter_spec.rb} +7 -7
- data/{test/html/test_fast.rb → spec/html/fast_spec.rb} +23 -23
- data/{test/html/test_pretty.rb → spec/html/pretty_spec.rb} +7 -7
- data/spec/map_spec.rb +39 -0
- data/{test/mixins/test_dispatcher.rb → spec/mixins/dispatcher_spec.rb} +12 -12
- data/{test/mixins/test_grammar_dsl.rb → spec/mixins/grammar_dsl_spec.rb} +19 -19
- data/{test/helper.rb → spec/spec_helper.rb} +5 -6
- data/{test/test_static_analyzer.rb → spec/static_analyzer_spec.rb} +6 -6
- data/spec/utils_spec.rb +39 -0
- data/temple.gemspec +3 -4
- metadata +34 -59
- data/.travis.yml +0 -30
- data/test/filters/test_string_splitter.rb +0 -25
- data/test/test_engine.rb +0 -189
- data/test/test_filter.rb +0 -29
- data/test/test_generator.rb +0 -158
- data/test/test_grammar.rb +0 -47
- data/test/test_map.rb +0 -39
- data/test/test_utils.rb +0 -39
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Temple::HTML::Pretty do
|
4
4
|
before do
|
@@ -6,9 +6,9 @@ describe Temple::HTML::Pretty do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should indent nested tags' do
|
9
|
-
@html.call([:html, :tag, 'div', [:multi],
|
9
|
+
expect(@html.call([:html, :tag, 'div', [:multi],
|
10
10
|
[:html, :tag, 'p', [:multi], [:multi, [:static, 'text'], [:dynamic, 'code']]]
|
11
|
-
]).
|
11
|
+
])).to eq [:multi,
|
12
12
|
[:code, "_temple_html_pretty1 = /<code|<pre|<textarea/"],
|
13
13
|
[:multi,
|
14
14
|
[:static, "<div"],
|
@@ -26,9 +26,9 @@ describe Temple::HTML::Pretty do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should not indent preformatted tags' do
|
29
|
-
@html.call([:html, :tag, 'pre', [:multi],
|
29
|
+
expect(@html.call([:html, :tag, 'pre', [:multi],
|
30
30
|
[:html, :tag, 'p', [:multi], [:static, 'text']]
|
31
|
-
]).
|
31
|
+
])).to eq [:multi,
|
32
32
|
[:code, "_temple_html_pretty1 = /<code|<pre|<textarea/"],
|
33
33
|
[:multi,
|
34
34
|
[:static, "<pre"],
|
@@ -45,9 +45,9 @@ describe Temple::HTML::Pretty do
|
|
45
45
|
|
46
46
|
it 'should not escape html_safe strings' do
|
47
47
|
with_html_safe do
|
48
|
-
@html.call(
|
48
|
+
expect(@html.call(
|
49
49
|
[:dynamic, '"text<".html_safe']
|
50
|
-
).
|
50
|
+
)).to eq [:multi,
|
51
51
|
[:code, "_temple_html_pretty1 = /<code|<pre|<textarea/"],
|
52
52
|
[:dynamic, "::Temple::Utils.indent_dynamic((\"text<\".html_safe), nil, \"\\n\", _temple_html_pretty1)"]]
|
53
53
|
end
|
data/spec/map_spec.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Temple::ImmutableMap do
|
4
|
+
it 'has read accessor' do
|
5
|
+
hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3})
|
6
|
+
expect(hash[:a]).to eq(1)
|
7
|
+
expect(hash[:b]).to eq(2)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'has include?' do
|
11
|
+
hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3})
|
12
|
+
expect(hash).to include(:a)
|
13
|
+
expect(hash).to include(:b)
|
14
|
+
expect(hash).not_to include(:c)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has values' do
|
18
|
+
expect(Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).values.sort).to eq([1,2])
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'has keys' do
|
22
|
+
expect(Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).keys).to eq([:a,:b])
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'has to_a' do
|
26
|
+
expect(Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).to_a).to eq([[:a, 1], [:b, 2]])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe Temple::MutableMap do
|
31
|
+
it 'has write accessor' do
|
32
|
+
parent = {a: 1}
|
33
|
+
hash = Temple::MutableMap.new(parent)
|
34
|
+
expect(hash[:a]).to eq(1)
|
35
|
+
hash[:a] = 2
|
36
|
+
expect(hash[:a]).to eq(2)
|
37
|
+
expect(parent[:a]).to eq(1)
|
38
|
+
end
|
39
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
class FilterWithDispatcherMixin
|
4
4
|
include Temple::Mixins::Dispatcher
|
@@ -40,31 +40,31 @@ describe Temple::Mixins::Dispatcher do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should return unhandled expressions' do
|
43
|
-
@filter.call([:unhandled]).
|
43
|
+
expect(@filter.call([:unhandled])).to eq([:unhandled])
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should dispatch first level' do
|
47
|
-
@filter.call([:test, 42]).
|
47
|
+
expect(@filter.call([:test, 42])).to eq([:on_test, 42])
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'should dispatch second level' do
|
51
|
-
@filter.call([:second, :test, 42]).
|
51
|
+
expect(@filter.call([:second, :test, 42])).to eq([:on_second_test, 42])
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should dispatch second level if prefixed' do
|
55
|
-
@filter.call([:test, :check, 42]).
|
55
|
+
expect(@filter.call([:test, :check, 42])).to eq([:on_check, 42])
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should dispatch parent level' do
|
59
|
-
@filter.call([:a, 42]).
|
60
|
-
@filter.call([:a, :b, 42]).
|
61
|
-
@filter.call([:a, :b, :test, 42]).
|
62
|
-
@filter.call([:a, :b, :c, 42]).
|
63
|
-
@filter.call([:a, :b, :c, :d, 42]).
|
64
|
-
@filter.call([:a, :b, :c, :d, :test, 42]).
|
59
|
+
expect(@filter.call([:a, 42])).to eq [:a, 42]
|
60
|
+
expect(@filter.call([:a, :b, 42])).to eq [:on_ab, 42]
|
61
|
+
expect(@filter.call([:a, :b, :test, 42])).to eq [:on_ab_test, 42]
|
62
|
+
expect(@filter.call([:a, :b, :c, 42])).to eq [:on_ab, :c, 42]
|
63
|
+
expect(@filter.call([:a, :b, :c, :d, 42])).to eq [:on_ab, :c, :d, 42]
|
64
|
+
expect(@filter.call([:a, :b, :c, :d, :test, 42])).to eq [:on_abcd_test, 42]
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should dispatch zero level' do
|
68
|
-
FilterWithDispatcherMixinAndOn.new.call([:foo,42]).
|
68
|
+
expect(FilterWithDispatcherMixinAndOn.new.call([:foo,42])).to eq [:on_zero, :foo, 42]
|
69
69
|
end
|
70
70
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
module BasicGrammar
|
4
4
|
extend Temple::Mixins::GrammarDSL
|
@@ -28,42 +28,42 @@ end
|
|
28
28
|
|
29
29
|
describe Temple::Mixins::GrammarDSL do
|
30
30
|
it 'should support class types' do
|
31
|
-
BasicGrammar.
|
32
|
-
BasicGrammar.
|
33
|
-
BasicGrammar.
|
34
|
-
BasicGrammar.
|
31
|
+
expect(BasicGrammar).to be_match(:symbol)
|
32
|
+
expect(BasicGrammar).not_to be_match([:symbol])
|
33
|
+
expect(BasicGrammar).not_to be_match('string')
|
34
|
+
expect(BasicGrammar).not_to be_match(['string'])
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should support value types' do
|
38
|
-
BasicGrammar.
|
39
|
-
BasicGrammar.
|
38
|
+
expect(BasicGrammar).to be_match(42)
|
39
|
+
expect(BasicGrammar).not_to be_match(43)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should support nesting' do
|
43
|
-
BasicGrammar.
|
43
|
+
expect(BasicGrammar).to be_match([:zero_or_more, [:zero_or_more]])
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should support *' do
|
47
|
-
BasicGrammar.
|
48
|
-
BasicGrammar.
|
47
|
+
expect(BasicGrammar).to be_match([:zero_or_more])
|
48
|
+
expect(BasicGrammar).to be_match([:zero_or_more, nil, 42])
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should support +' do
|
52
|
-
BasicGrammar.
|
53
|
-
BasicGrammar.
|
54
|
-
BasicGrammar.
|
52
|
+
expect(BasicGrammar).not_to be_match([:one_or_more])
|
53
|
+
expect(BasicGrammar).to be_match( [:one_or_more, 42])
|
54
|
+
expect(BasicGrammar).to be_match( [:one_or_more, 42, nil])
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should support ?' do
|
58
|
-
BasicGrammar.
|
59
|
-
BasicGrammar.
|
60
|
-
BasicGrammar.
|
58
|
+
expect(BasicGrammar).not_to be_match([:zero_or_one, nil, 42])
|
59
|
+
expect(BasicGrammar).to be_match( [:zero_or_one])
|
60
|
+
expect(BasicGrammar).to be_match( [:zero_or_one, 42])
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should support extended grammars' do
|
64
|
-
ExtendedGrammar.
|
65
|
-
BasicGrammar.
|
66
|
-
BasicGrammar.
|
64
|
+
expect(ExtendedGrammar).to be_match([:extended, [:extended, 42]])
|
65
|
+
expect(BasicGrammar).not_to be_match([:zero_or_more, [:extended, nil]])
|
66
|
+
expect(BasicGrammar).not_to be_match([:extended, [:extended, 42]])
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should have validate!' do
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'bacon'
|
2
1
|
require 'temple'
|
3
2
|
|
4
3
|
module TestHelper
|
@@ -13,18 +12,18 @@ module TestHelper
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def grammar_validate(grammar, exp, message)
|
16
|
-
|
15
|
+
expect { grammar.validate!(exp) }.to raise_error(Temple::InvalidExpression, message)
|
17
16
|
end
|
18
17
|
|
19
18
|
def erb(src, options = {})
|
20
19
|
Temple::ERB::Template.new(options) { src }.render
|
21
20
|
end
|
22
21
|
|
23
|
-
def
|
24
|
-
Tilt::
|
22
|
+
def erubi(src, options = {})
|
23
|
+
Tilt::ErubiTemplate.new(options) { src }.render
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
|
-
include TestHelper
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.include TestHelper
|
30
29
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Temple::StaticAnalyzer do
|
4
4
|
describe '.available?' do
|
5
5
|
it 'should return true if its dependency is available' do
|
6
|
-
Temple::StaticAnalyzer.available
|
6
|
+
expect(Temple::StaticAnalyzer.available?).to eq(defined?(Ripper) && Ripper.respond_to?(:lex))
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -11,13 +11,13 @@ describe Temple::StaticAnalyzer do
|
|
11
11
|
describe '.static?' do
|
12
12
|
it 'should return true if given Ruby expression is static' do
|
13
13
|
['true', 'false', '"hello world"', "[1, { 2 => 3 }]", "[\n1,\n]"].each do |exp|
|
14
|
-
Temple::StaticAnalyzer.static?(exp).
|
14
|
+
expect(Temple::StaticAnalyzer.static?(exp)).to eq(true)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should return false if given Ruby expression is dynamic' do
|
19
19
|
['1 + 2', 'variable', 'method_call(a)', 'CONSTANT'].each do |exp|
|
20
|
-
Temple::StaticAnalyzer.static?(exp).
|
20
|
+
expect(Temple::StaticAnalyzer.static?(exp)).to eq(false)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -25,13 +25,13 @@ describe Temple::StaticAnalyzer do
|
|
25
25
|
describe '.syntax_error?' do
|
26
26
|
it 'should return false if given Ruby expression is valid' do
|
27
27
|
['Foo.bar.baz { |c| c.d! }', '{ foo: bar }'].each do |exp|
|
28
|
-
Temple::StaticAnalyzer.syntax_error?(exp).
|
28
|
+
expect(Temple::StaticAnalyzer.syntax_error?(exp)).to eq(false)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should return true if given Ruby expression is invalid' do
|
33
33
|
['Foo.bar.baz { |c| c.d! ', ' foo: bar '].each do |exp|
|
34
|
-
Temple::StaticAnalyzer.syntax_error?(exp).
|
34
|
+
expect(Temple::StaticAnalyzer.syntax_error?(exp)).to eq(true)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/spec/utils_spec.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class UniqueTest
|
4
|
+
include Temple::Utils
|
5
|
+
end
|
6
|
+
|
7
|
+
describe Temple::Utils do
|
8
|
+
it 'has empty_exp?' do
|
9
|
+
expect(Temple::Utils.empty_exp?([:multi])).to eq(true)
|
10
|
+
expect(Temple::Utils.empty_exp?([:multi, [:multi]])).to eq(true)
|
11
|
+
expect(Temple::Utils.empty_exp?([:multi, [:multi, [:newline]], [:newline]])).to eq(true)
|
12
|
+
expect(Temple::Utils.empty_exp?([:multi])).to eq(true)
|
13
|
+
expect(Temple::Utils.empty_exp?([:multi, [:multi, [:static, 'text']]])).to eq(false)
|
14
|
+
expect(Temple::Utils.empty_exp?([:multi, [:newline], [:multi, [:dynamic, 'text']]])).to eq(false)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has unique_name' do
|
18
|
+
u = UniqueTest.new
|
19
|
+
expect(u.unique_name).to eq('_uniquetest1')
|
20
|
+
expect(u.unique_name).to eq('_uniquetest2')
|
21
|
+
expect(UniqueTest.new.unique_name).to eq('_uniquetest1')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'has escape_html' do
|
25
|
+
expect(Temple::Utils.escape_html('<')).to eq('<')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should escape unsafe html strings' do
|
29
|
+
with_html_safe do
|
30
|
+
expect(Temple::Utils.escape_html_safe('<')).to eq('<')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should not escape safe html strings' do
|
35
|
+
with_html_safe do
|
36
|
+
expect(Temple::Utils.escape_html_safe('<'.html_safe)).to eq('<')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/temple.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require File.dirname(__FILE__) + '/lib/temple/version'
|
3
2
|
require 'date'
|
4
3
|
|
@@ -18,12 +17,12 @@ Gem::Specification.new do |s|
|
|
18
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
18
|
s.license = 'MIT'
|
20
19
|
|
21
|
-
s.required_ruby_version = '>=
|
20
|
+
s.required_ruby_version = '>= 2.5.0'
|
22
21
|
|
23
22
|
# Tilt is only development dependency because most parts of Temple
|
24
23
|
# can be used without it.
|
25
24
|
s.add_development_dependency('tilt')
|
26
|
-
s.add_development_dependency('
|
25
|
+
s.add_development_dependency('rspec')
|
27
26
|
s.add_development_dependency('rake')
|
28
|
-
s.add_development_dependency('
|
27
|
+
s.add_development_dependency('erubi')
|
29
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: temple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Holm
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: erubi
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
@@ -75,8 +75,8 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
+
- ".github/workflows/test.yml"
|
78
79
|
- ".gitignore"
|
79
|
-
- ".travis.yml"
|
80
80
|
- ".yardopts"
|
81
81
|
- CHANGES
|
82
82
|
- EXPRESSIONS.md
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/temple/erb/trimming.rb
|
93
93
|
- lib/temple/exceptions.rb
|
94
94
|
- lib/temple/filter.rb
|
95
|
+
- lib/temple/filters/ambles.rb
|
95
96
|
- lib/temple/filters/code_merger.rb
|
96
97
|
- lib/temple/filters/control_flow.rb
|
97
98
|
- lib/temple/filters/dynamic_inliner.rb
|
@@ -132,32 +133,32 @@ files:
|
|
132
133
|
- lib/temple/templates/tilt.rb
|
133
134
|
- lib/temple/utils.rb
|
134
135
|
- lib/temple/version.rb
|
136
|
+
- spec/engine_spec.rb
|
137
|
+
- spec/erb_spec.rb
|
138
|
+
- spec/filter_spec.rb
|
139
|
+
- spec/filters/code_merger_spec.rb
|
140
|
+
- spec/filters/control_flow_spec.rb
|
141
|
+
- spec/filters/dynamic_inliner_spec.rb
|
142
|
+
- spec/filters/eraser_spec.rb
|
143
|
+
- spec/filters/escapable_spec.rb
|
144
|
+
- spec/filters/multi_flattener_spec.rb
|
145
|
+
- spec/filters/static_analyzer_spec.rb
|
146
|
+
- spec/filters/static_merger_spec.rb
|
147
|
+
- spec/filters/string_splitter_spec.rb
|
148
|
+
- spec/generator_spec.rb
|
149
|
+
- spec/grammar_spec.rb
|
150
|
+
- spec/html/attribute_merger_spec.rb
|
151
|
+
- spec/html/attribute_remover_spec.rb
|
152
|
+
- spec/html/attribute_sorter_spec.rb
|
153
|
+
- spec/html/fast_spec.rb
|
154
|
+
- spec/html/pretty_spec.rb
|
155
|
+
- spec/map_spec.rb
|
156
|
+
- spec/mixins/dispatcher_spec.rb
|
157
|
+
- spec/mixins/grammar_dsl_spec.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/static_analyzer_spec.rb
|
160
|
+
- spec/utils_spec.rb
|
135
161
|
- temple.gemspec
|
136
|
-
- test/filters/test_code_merger.rb
|
137
|
-
- test/filters/test_control_flow.rb
|
138
|
-
- test/filters/test_dynamic_inliner.rb
|
139
|
-
- test/filters/test_eraser.rb
|
140
|
-
- test/filters/test_escapable.rb
|
141
|
-
- test/filters/test_multi_flattener.rb
|
142
|
-
- test/filters/test_static_analyzer.rb
|
143
|
-
- test/filters/test_static_merger.rb
|
144
|
-
- test/filters/test_string_splitter.rb
|
145
|
-
- test/helper.rb
|
146
|
-
- test/html/test_attribute_merger.rb
|
147
|
-
- test/html/test_attribute_remover.rb
|
148
|
-
- test/html/test_attribute_sorter.rb
|
149
|
-
- test/html/test_fast.rb
|
150
|
-
- test/html/test_pretty.rb
|
151
|
-
- test/mixins/test_dispatcher.rb
|
152
|
-
- test/mixins/test_grammar_dsl.rb
|
153
|
-
- test/test_engine.rb
|
154
|
-
- test/test_erb.rb
|
155
|
-
- test/test_filter.rb
|
156
|
-
- test/test_generator.rb
|
157
|
-
- test/test_grammar.rb
|
158
|
-
- test/test_map.rb
|
159
|
-
- test/test_static_analyzer.rb
|
160
|
-
- test/test_utils.rb
|
161
162
|
homepage: https://github.com/judofyr/temple
|
162
163
|
licenses:
|
163
164
|
- MIT
|
@@ -170,41 +171,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
171
|
requirements:
|
171
172
|
- - ">="
|
172
173
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
174
|
+
version: 2.5.0
|
174
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
176
|
requirements:
|
176
177
|
- - ">="
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
|
-
|
181
|
-
rubygems_version: 2.6.11
|
181
|
+
rubygems_version: 3.2.5
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Template compilation framework in Ruby
|
185
|
-
test_files:
|
186
|
-
- test/filters/test_code_merger.rb
|
187
|
-
- test/filters/test_control_flow.rb
|
188
|
-
- test/filters/test_dynamic_inliner.rb
|
189
|
-
- test/filters/test_eraser.rb
|
190
|
-
- test/filters/test_escapable.rb
|
191
|
-
- test/filters/test_multi_flattener.rb
|
192
|
-
- test/filters/test_static_analyzer.rb
|
193
|
-
- test/filters/test_static_merger.rb
|
194
|
-
- test/filters/test_string_splitter.rb
|
195
|
-
- test/helper.rb
|
196
|
-
- test/html/test_attribute_merger.rb
|
197
|
-
- test/html/test_attribute_remover.rb
|
198
|
-
- test/html/test_attribute_sorter.rb
|
199
|
-
- test/html/test_fast.rb
|
200
|
-
- test/html/test_pretty.rb
|
201
|
-
- test/mixins/test_dispatcher.rb
|
202
|
-
- test/mixins/test_grammar_dsl.rb
|
203
|
-
- test/test_engine.rb
|
204
|
-
- test/test_erb.rb
|
205
|
-
- test/test_filter.rb
|
206
|
-
- test/test_generator.rb
|
207
|
-
- test/test_grammar.rb
|
208
|
-
- test/test_map.rb
|
209
|
-
- test/test_static_analyzer.rb
|
210
|
-
- test/test_utils.rb
|
185
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: trusty
|
3
|
-
|
4
|
-
cache: bundler
|
5
|
-
|
6
|
-
rvm:
|
7
|
-
- 1.9.3
|
8
|
-
- 2.0.0
|
9
|
-
- 2.1.10
|
10
|
-
- 2.2.6
|
11
|
-
- 2.3.3
|
12
|
-
- ruby-head
|
13
|
-
- jruby-19mode
|
14
|
-
- rbx-3
|
15
|
-
|
16
|
-
sudo: false
|
17
|
-
|
18
|
-
env:
|
19
|
-
- ESCAPE_UTILS=1
|
20
|
-
- ""
|
21
|
-
|
22
|
-
matrix:
|
23
|
-
allow_failures:
|
24
|
-
- rvm: ruby-head
|
25
|
-
- rvm: rbx-3
|
26
|
-
exclude:
|
27
|
-
- rvm: jruby-19mode
|
28
|
-
env: ESCAPE_UTILS=1
|
29
|
-
- rvm: rbx-3
|
30
|
-
env: ESCAPE_UTILS=1
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
begin
|
3
|
-
require 'ripper'
|
4
|
-
rescue LoadError
|
5
|
-
end
|
6
|
-
|
7
|
-
if defined?(Ripper) && RUBY_VERSION >= "2.0.0"
|
8
|
-
describe Temple::Filters::StringSplitter do
|
9
|
-
before do
|
10
|
-
@filter = Temple::Filters::StringSplitter.new
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should split :dynamic with string literal' do
|
14
|
-
@filter.call([:dynamic, '"static#{dynamic}"']
|
15
|
-
).should.equal [:multi, [:static, 'static'], [:dynamic, 'dynamic']]
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '.compile' do
|
19
|
-
it 'should raise CompileError for non-string literals' do
|
20
|
-
lambda { Temple::Filters::StringSplitter.compile('1') }.
|
21
|
-
should.raise(Temple::FilterError)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|