slim 2.1.0 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -24
- data/CHANGES +8 -0
- data/Gemfile +5 -7
- data/README.jp.md +29 -31
- data/README.md +34 -34
- data/Rakefile +9 -7
- data/benchmarks/context.rb +3 -3
- data/benchmarks/run-benchmarks.rb +9 -9
- data/benchmarks/view.slim +1 -1
- data/doc/jp/logic_less.md +7 -7
- data/doc/logic_less.md +7 -7
- data/lib/slim/command.rb +6 -16
- data/lib/slim/embedded.rb +10 -13
- data/lib/slim/engine.rb +21 -23
- data/lib/slim/erb_converter.rb +2 -1
- data/lib/slim/include.rb +2 -2
- data/lib/slim/logic_less.rb +1 -2
- data/lib/slim/logic_less/filter.rb +3 -3
- data/lib/slim/parser.rb +43 -19
- data/lib/slim/smart.rb +3 -3
- data/lib/slim/smart/escaper.rb +1 -1
- data/lib/slim/smart/filter.rb +3 -3
- data/lib/slim/smart/parser.rb +6 -4
- data/lib/slim/splat/builder.rb +9 -4
- data/lib/slim/splat/filter.rb +3 -4
- data/lib/slim/template.rb +5 -5
- data/lib/slim/translator.rb +12 -13
- data/lib/slim/version.rb +1 -1
- data/slim.gemspec +3 -1
- data/test/core/helper.rb +3 -3
- data/test/core/test_code_escaping.rb +14 -14
- data/test/core/test_code_evaluation.rb +1 -1
- data/test/core/test_code_output.rb +1 -1
- data/test/core/test_embedded_engines.rb +16 -16
- data/test/core/test_encoding.rb +4 -4
- data/test/core/test_html_attributes.rb +9 -9
- data/test/core/test_html_structure.rb +20 -20
- data/test/core/test_parser_errors.rb +1 -1
- data/test/core/test_pretty.rb +4 -4
- data/test/core/test_ruby_errors.rb +5 -5
- data/test/core/test_slim_template.rb +2 -2
- data/test/core/test_tabs.rb +5 -5
- data/test/core/test_thread_options.rb +4 -4
- data/test/core/test_unicode.rb +11 -13
- data/test/include/test_include.rb +2 -2
- data/test/literate/TESTS.md +37 -8
- data/test/literate/helper.rb +2 -2
- data/test/logic_less/test_logic_less.rb +37 -37
- data/test/rails/app/controllers/slim_controller.rb +3 -3
- data/test/rails/config/initializers/session_store.rb +1 -1
- data/test/rails/config/routes.rb +4 -4
- data/test/rails/test/test_slim.rb +9 -15
- data/test/smart/test_smart_text.rb +5 -9
- data/test/translator/test_translator.rb +14 -14
- metadata +7 -7
@@ -4,7 +4,7 @@ require 'slim/translator'
|
|
4
4
|
class TestSlimTranslator < TestSlim
|
5
5
|
def setup
|
6
6
|
super
|
7
|
-
Slim::Engine.
|
7
|
+
Slim::Engine.set_options tr: true, tr_fn: 'TestSlimTranslator.tr'
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.tr(s)
|
@@ -29,14 +29,14 @@ markdown:
|
|
29
29
|
|
30
30
|
case Tilt['md'].name.downcase
|
31
31
|
when /redcarpet/
|
32
|
-
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n", source, :
|
33
|
-
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n", source, :
|
32
|
+
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n", source, tr_mode: :dynamic
|
33
|
+
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n", source, tr_mode: :static
|
34
34
|
when /rdiscount/
|
35
|
-
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n", source, :
|
36
|
-
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n", source, :
|
35
|
+
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n", source, tr_mode: :dynamic
|
36
|
+
assert_html "<h1>Header</h1>\n\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n", source, tr_mode: :static
|
37
37
|
when /kramdown/
|
38
|
-
assert_html "<h1 id=\"header\">Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source, :
|
39
|
-
assert_html "<h1 id=\"header\">Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source, :
|
38
|
+
assert_html "<h1 id=\"header\">Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source, tr_mode: :dynamic
|
39
|
+
assert_html "<h1 id=\"header\">Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source, tr_mode: :static
|
40
40
|
else
|
41
41
|
raise "Missing test for #{Tilt['md']}"
|
42
42
|
end
|
@@ -49,8 +49,8 @@ markdown:
|
|
49
49
|
a href="link" page
|
50
50
|
}
|
51
51
|
|
52
|
-
assert_html "THIS IS\nA LINK TO <a href=\"link\">PAGE</a>", source, :
|
53
|
-
assert_html "THIS IS\nA LINK TO <a href=\"link\">PAGE</a>", source, :
|
52
|
+
assert_html "THIS IS\nA LINK TO <a href=\"link\">PAGE</a>", source, tr_mode: :dynamic
|
53
|
+
assert_html "THIS IS\nA LINK TO <a href=\"link\">PAGE</a>", source, tr_mode: :static
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_translation_and_interpolation
|
@@ -60,9 +60,9 @@ p translate #{hello_world} this
|
|
60
60
|
third #{1+2} line
|
61
61
|
}
|
62
62
|
|
63
|
-
assert_html "<p>translate Hello World from @env this\nsecond line\nthird 3 line</p>", source, :
|
64
|
-
assert_html "<p>TRANSLATE Hello World from @env THIS\nSECOND LINE\nTHIRD 3 LINE</p>", source, :
|
65
|
-
assert_html "<p>TRANSLATE Hello World from @env THIS\nSECOND LINE\nTHIRD 3 LINE</p>", source, :
|
63
|
+
assert_html "<p>translate Hello World from @env this\nsecond line\nthird 3 line</p>", source, tr: false
|
64
|
+
assert_html "<p>TRANSLATE Hello World from @env THIS\nSECOND LINE\nTHIRD 3 LINE</p>", source, tr_mode: :dynamic
|
65
|
+
assert_html "<p>TRANSLATE Hello World from @env THIS\nSECOND LINE\nTHIRD 3 LINE</p>", source, tr_mode: :static
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_translation_reverse
|
@@ -70,7 +70,7 @@ p translate #{hello_world} this
|
|
70
70
|
' alpha #{1} beta #{2} gamma #{3}
|
71
71
|
}
|
72
72
|
|
73
|
-
assert_html "3 ammag 2 ateb 1 ahpla ", source, :
|
74
|
-
assert_html "3 ammag 2 ateb 1 ahpla ", source, :
|
73
|
+
assert_html "3 ammag 2 ateb 1 ahpla ", source, tr_mode: :dynamic, tr_fn: 'TestSlimTranslator.tr_reverse'
|
74
|
+
assert_html "3 ammag 2 ateb 1 ahpla ", source, tr_mode: :static, tr_fn: 'TestSlimTranslator.tr_reverse'
|
75
75
|
end
|
76
76
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: temple
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.7.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.7.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: tilt
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,12 +188,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
requirements:
|
189
189
|
- - ">="
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
191
|
+
version: 1.9.2
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
|
-
- - "
|
194
|
+
- - ">"
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
196
|
+
version: 1.3.1
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project: slim
|
199
199
|
rubygems_version: 2.2.2
|