slim 4.1.0 → 5.0.0
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 +4 -4
- data/.github/workflows/test.yml +51 -0
- data/.yardopts +1 -1
- data/CHANGES +19 -7
- data/Gemfile +16 -26
- data/LICENSE +1 -1
- data/README.jp.md +19 -20
- data/README.md +23 -24
- data/Rakefile +1 -3
- data/benchmarks/run-benchmarks.rb +7 -12
- data/doc/jp/translator.md +1 -1
- data/doc/logic_less.md +1 -1
- data/doc/translator.md +1 -1
- data/lib/slim/do_inserter.rb +1 -1
- data/lib/slim/embedded.rb +12 -11
- data/lib/slim/end_inserter.rb +2 -2
- data/lib/slim/engine.rb +2 -0
- data/lib/slim/parser.rb +0 -23
- data/lib/slim/railtie.rb +17 -0
- data/lib/slim/splat/builder.rb +8 -2
- data/lib/slim/splat/filter.rb +2 -1
- data/lib/slim/template.rb +0 -14
- data/lib/slim/version.rb +1 -1
- data/lib/slim.rb +1 -0
- data/slim.gemspec +3 -4
- data/test/core/test_code_evaluation.rb +1 -0
- data/test/core/test_code_structure.rb +17 -0
- data/test/core/test_commands.rb +8 -7
- data/test/core/test_embedded_engines.rb +18 -14
- data/test/core/test_erb_converter.rb +4 -6
- data/test/core/test_html_attributes.rb +8 -0
- data/test/core/test_pretty.rb +4 -7
- data/test/literate/TESTS.md +22 -22
- data/test/literate/run.rb +2 -2
- data/test/rails/config/application.rb +0 -17
- data/test/rails/test/test_slim.rb +6 -12
- data/test/sinatra/helper.rb +0 -2
- metadata +11 -17
- data/.travis.yml +0 -38
- data/test/rails/config/initializers/secret_token.rb +0 -7
data/test/literate/TESTS.md
CHANGED
@@ -95,13 +95,13 @@ renders as
|
|
95
95
|
You can embed html code in the text which is not escaped.
|
96
96
|
|
97
97
|
~~~ slim
|
98
|
-
| <a href="http://slim-
|
98
|
+
| <a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|
99
99
|
~~~
|
100
100
|
|
101
101
|
renders as
|
102
102
|
|
103
103
|
~~~ html
|
104
|
-
<a href="http://slim-
|
104
|
+
<a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|
105
105
|
~~~
|
106
106
|
|
107
107
|
### Text with trailing white space `'`
|
@@ -122,13 +122,13 @@ This is especially useful if you use tags behind a text block.
|
|
122
122
|
|
123
123
|
~~~ slim
|
124
124
|
' Link to
|
125
|
-
a href="http://slim-
|
125
|
+
a href="http://github.com/slim-template/slim" github.com/slim-template/slim
|
126
126
|
~~~
|
127
127
|
|
128
128
|
renders as
|
129
129
|
|
130
130
|
~~~ html
|
131
|
-
Link to <a href="http://slim-
|
131
|
+
Link to <a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|
132
132
|
~~~
|
133
133
|
|
134
134
|
Multiple lines can be indented beneath the first text line.
|
@@ -186,13 +186,13 @@ lines
|
|
186
186
|
HTML can be written directly.
|
187
187
|
|
188
188
|
~~~ slim
|
189
|
-
<a href="http://slim-
|
189
|
+
<a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|
190
190
|
~~~
|
191
191
|
|
192
192
|
renders as
|
193
193
|
|
194
194
|
~~~ html
|
195
|
-
<a href="http://slim-
|
195
|
+
<a href="http://github.com/slim-template/slim">github.com/slim-template/slim</a>
|
196
196
|
~~~
|
197
197
|
|
198
198
|
HTML tags allow nested blocks inside.
|
@@ -800,31 +800,31 @@ If a delimiter makes the syntax more readable for you, you can use the character
|
|
800
800
|
|
801
801
|
~~~ slim
|
802
802
|
li
|
803
|
-
a(href="http://slim-
|
803
|
+
a(href="http://github.com/slim-template/slim" class="important") Link
|
804
804
|
li
|
805
|
-
a[href="http://slim-
|
805
|
+
a[href="http://github.com/slim-template/slim" class="important"] Link
|
806
806
|
li
|
807
|
-
a{href="http://slim-
|
807
|
+
a{href="http://github.com/slim-template/slim" class="important"} Link
|
808
808
|
~~~
|
809
809
|
|
810
810
|
renders as
|
811
811
|
|
812
812
|
~~~ html
|
813
813
|
<li>
|
814
|
-
<a class="important" href="http://slim-
|
814
|
+
<a class="important" href="http://github.com/slim-template/slim">Link</a>
|
815
815
|
</li>
|
816
816
|
<li>
|
817
|
-
<a class="important" href="http://slim-
|
817
|
+
<a class="important" href="http://github.com/slim-template/slim">Link</a>
|
818
818
|
</li>
|
819
819
|
<li>
|
820
|
-
<a class="important" href="http://slim-
|
820
|
+
<a class="important" href="http://github.com/slim-template/slim">Link</a>
|
821
821
|
</li>
|
822
822
|
~~~
|
823
823
|
|
824
824
|
If you wrap the attributes, you can spread them across multiple lines:
|
825
825
|
|
826
826
|
~~~ slim
|
827
|
-
a(href="http://slim-
|
827
|
+
a(href="http://github.com/slim-template/slim"
|
828
828
|
|
829
829
|
class="important") Link
|
830
830
|
~~~
|
@@ -832,7 +832,7 @@ a(href="http://slim-lang.com"
|
|
832
832
|
renders as
|
833
833
|
|
834
834
|
~~~ html
|
835
|
-
<a class="important" href="http://slim-
|
835
|
+
<a class="important" href="http://github.com/slim-template/slim">Link</a>
|
836
836
|
~~~
|
837
837
|
|
838
838
|
~~~ slim
|
@@ -872,19 +872,19 @@ renders as
|
|
872
872
|
You can use single or double quotes for simple text attributes.
|
873
873
|
|
874
874
|
~~~ slim
|
875
|
-
a href="http://slim-
|
875
|
+
a href="http://github.com/slim-template/slim" title='Slim Homepage' Goto the Slim homepage
|
876
876
|
~~~
|
877
877
|
|
878
878
|
renders as
|
879
879
|
|
880
880
|
~~~ html
|
881
|
-
<a href="http://slim-
|
881
|
+
<a href="http://github.com/slim-template/slim" title="Slim Homepage">Goto the Slim homepage</a>
|
882
882
|
~~~
|
883
883
|
|
884
884
|
You can use text interpolation in the quoted attributes:
|
885
885
|
|
886
886
|
~~~ slim
|
887
|
-
- url='slim-
|
887
|
+
- url='github.com/slim-template/slim'
|
888
888
|
a href="http://#{url}" Goto the #{url}
|
889
889
|
a href="{"test"}" Test of quoted text in braces
|
890
890
|
~~~
|
@@ -892,7 +892,7 @@ a href="{"test"}" Test of quoted text in braces
|
|
892
892
|
renders as
|
893
893
|
|
894
894
|
~~~ html
|
895
|
-
<a href="http://slim-
|
895
|
+
<a href="http://github.com/slim-template/slim">Goto the github.com/slim-template/slim</a><a href="{"test"}">Test of quoted text in braces</a>
|
896
896
|
~~~
|
897
897
|
|
898
898
|
The attribute value will be escaped by default. Use == if you want to disable escaping in the attribute.
|
@@ -1040,13 +1040,13 @@ You can configure attributes to be merged if multiple are given (See option `:me
|
|
1040
1040
|
this is done for class attributes with the white space as delimiter.
|
1041
1041
|
|
1042
1042
|
~~~ slim
|
1043
|
-
a.menu class="highlight" href="http://
|
1043
|
+
a.menu class="highlight" href="http://github.com/slim-template/slim/" github.com/slim-template/slim
|
1044
1044
|
~~~
|
1045
1045
|
|
1046
1046
|
renders as
|
1047
1047
|
|
1048
1048
|
~~~ html
|
1049
|
-
<a class="menu highlight" href="http://
|
1049
|
+
<a class="menu highlight" href="http://github.com/slim-template/slim/">github.com/slim-template/slim</a>
|
1050
1050
|
~~~
|
1051
1051
|
|
1052
1052
|
You can also use an `Array` as attribute value and the array elements will be merged using the delimiter.
|
@@ -1074,7 +1074,7 @@ with the :tag key.
|
|
1074
1074
|
~~~ slim
|
1075
1075
|
ruby:
|
1076
1076
|
def self.a_unless_current
|
1077
|
-
@page_current ? {tag: 'span'} : {tag: 'a', href: 'http://
|
1077
|
+
@page_current ? {tag: 'span'} : {tag: 'a', href: 'http://github.com/slim-template/slim/'}
|
1078
1078
|
end
|
1079
1079
|
- @page_current = true
|
1080
1080
|
*a_unless_current Link
|
@@ -1085,7 +1085,7 @@ ruby:
|
|
1085
1085
|
renders as
|
1086
1086
|
|
1087
1087
|
~~~ html
|
1088
|
-
<span>Link</span><a href="http://
|
1088
|
+
<span>Link</span><a href="http://github.com/slim-template/slim/">Link</a>
|
1089
1089
|
~~~
|
1090
1090
|
|
1091
1091
|
### Shortcuts
|
data/test/literate/run.rb
CHANGED
@@ -65,9 +65,9 @@ class LiterateTest < Temple::Engine
|
|
65
65
|
@in_testcase = false
|
66
66
|
result = " html = #{code.inspect}\n"
|
67
67
|
if @opts.empty?
|
68
|
-
result << " render(slim).must_equal html\nend\n"
|
68
|
+
result << " _(render(slim)).must_equal html\nend\n"
|
69
69
|
else
|
70
|
-
result << " options = #{@opts.inspect}\n render(slim, options).must_equal html\nend\n"
|
70
|
+
result << " options = #{@opts.inspect}\n _(render(slim, options)).must_equal html\nend\n"
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -6,9 +6,7 @@ require 'action_view/railtie'
|
|
6
6
|
#require 'active_record/railtie'
|
7
7
|
#require 'action_mailer/railtie'
|
8
8
|
require 'sprockets/railtie'
|
9
|
-
|
10
9
|
require 'slim'
|
11
|
-
require 'slim-rails/register_engine'
|
12
10
|
|
13
11
|
module Dummy
|
14
12
|
class Application < Rails::Application
|
@@ -42,20 +40,5 @@ module Dummy
|
|
42
40
|
|
43
41
|
# Configure sensitive parameters which will be filtered from the log file.
|
44
42
|
config.filter_parameters += [:password]
|
45
|
-
|
46
|
-
# From slim-rails fix for "ActionView::Template::Error: Unknown line indicator"
|
47
|
-
# https://github.com/slim-template/slim-rails/blob/991589ea5648e5e896781e68912bc51beaf4102a/lib/slim-rails/register_engine.rb
|
48
|
-
if config.respond_to?(:assets)
|
49
|
-
config.assets.configure do |env|
|
50
|
-
if env.respond_to?(:register_transformer) && Sprockets::VERSION.to_i > 3
|
51
|
-
env.register_mime_type 'text/slim', extensions: ['.slim', '.slim.html']
|
52
|
-
env.register_transformer 'text/slim', 'text/html', Slim::Rails::RegisterEngine::Transformer
|
53
|
-
elsif env.respond_to?(:register_engine)
|
54
|
-
args = ['.slim', Slim::Template]
|
55
|
-
args << { silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
|
56
|
-
env.register_engine(*args)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
43
|
end
|
61
44
|
end
|
@@ -46,18 +46,12 @@ class TestSlim < ActionDispatch::IntegrationTest
|
|
46
46
|
assert_html "<h1>Hello Slim!</h1><p>With a partial!</p>"
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
test "streaming" do
|
56
|
-
get "/slim/streaming"
|
57
|
-
output = "2f\r\n<!DOCTYPE html><html><head><title>Dummy</title>\r\nd\r\n</head><body>\r\n17\r\nHeading set from a view\r\n15\r\n<div class=\"content\">\r\n53\r\n<p>Page content</p><h1><p>Hello Streaming!</p></h1><h2><p>Hello Streaming!</p></h2>\r\n14\r\n</div></body></html>\r\n0\r\n\r\n"
|
58
|
-
assert_equal output, @response.body
|
59
|
-
end
|
60
|
-
end
|
49
|
+
# TODO Reenable streaming test
|
50
|
+
# test "streaming" do
|
51
|
+
# get "/slim/streaming"
|
52
|
+
# output = "2f\r\n<!DOCTYPE html><html><head><title>Dummy</title>\r\nd\r\n</head><body>\r\n17\r\nHeading set from a view\r\n15\r\n<div class=\"content\">\r\n53\r\n<p>Page content</p><h1><p>Hello Streaming!</p></h1><h2><p>Hello Streaming!</p></h2>\r\n14\r\n</div></body></html>\r\n0\r\n\r\n"
|
53
|
+
# assert_equal output, @response.body
|
54
|
+
# end
|
61
55
|
|
62
56
|
test "render integers" do
|
63
57
|
get "/slim/integers"
|
data/test/sinatra/helper.rb
CHANGED
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: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -10,28 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: temple
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.7.6
|
22
|
-
- - "<"
|
19
|
+
- - "~>"
|
23
20
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
21
|
+
version: 0.10.0
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
requirements:
|
29
|
-
- - "
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: 0.7.6
|
32
|
-
- - "<"
|
26
|
+
- - "~>"
|
33
27
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
28
|
+
version: 0.10.0
|
35
29
|
- !ruby/object:Gem::Dependency
|
36
30
|
name: tilt
|
37
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,8 +57,8 @@ executables:
|
|
63
57
|
extensions: []
|
64
58
|
extra_rdoc_files: []
|
65
59
|
files:
|
60
|
+
- ".github/workflows/test.yml"
|
66
61
|
- ".gitignore"
|
67
|
-
- ".travis.yml"
|
68
62
|
- ".yardopts"
|
69
63
|
- CHANGES
|
70
64
|
- Gemfile
|
@@ -106,6 +100,7 @@ files:
|
|
106
100
|
- lib/slim/logic_less/context.rb
|
107
101
|
- lib/slim/logic_less/filter.rb
|
108
102
|
- lib/slim/parser.rb
|
103
|
+
- lib/slim/railtie.rb
|
109
104
|
- lib/slim/smart.rb
|
110
105
|
- lib/slim/smart/escaper.rb
|
111
106
|
- lib/slim/smart/filter.rb
|
@@ -177,7 +172,6 @@ files:
|
|
177
172
|
- test/rails/config/initializers/backtrace_silencers.rb
|
178
173
|
- test/rails/config/initializers/inflections.rb
|
179
174
|
- test/rails/config/initializers/mime_types.rb
|
180
|
-
- test/rails/config/initializers/secret_token.rb
|
181
175
|
- test/rails/config/initializers/session_store.rb
|
182
176
|
- test/rails/config/locales/en.yml
|
183
177
|
- test/rails/config/routes.rb
|
@@ -195,7 +189,7 @@ files:
|
|
195
189
|
- test/sinatra/views/layout2.slim
|
196
190
|
- test/smart/test_smart_text.rb
|
197
191
|
- test/translator/test_translator.rb
|
198
|
-
homepage: http://
|
192
|
+
homepage: http://github.com/slim-template/slim/
|
199
193
|
licenses:
|
200
194
|
- MIT
|
201
195
|
metadata: {}
|
@@ -207,14 +201,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
201
|
requirements:
|
208
202
|
- - ">="
|
209
203
|
- !ruby/object:Gem::Version
|
210
|
-
version: 2.
|
204
|
+
version: 2.5.0
|
211
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
206
|
requirements:
|
213
207
|
- - ">="
|
214
208
|
- !ruby/object:Gem::Version
|
215
209
|
version: '0'
|
216
210
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.2.5
|
218
212
|
signing_key:
|
219
213
|
specification_version: 4
|
220
214
|
summary: Slim is a template language.
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# https://www.ruby-lang.org/en/downloads/releases/
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.6.1
|
5
|
-
- 2.5.3
|
6
|
-
- 2.4.5
|
7
|
-
- jruby-9.2.6.0
|
8
|
-
- jruby-9.1.17.0
|
9
|
-
|
10
|
-
# Recommend sudo required when using trusty dist
|
11
|
-
# https://docs.travis-ci.com/user/reference/trusty/
|
12
|
-
sudo: required
|
13
|
-
dist: trusty
|
14
|
-
|
15
|
-
script: "bundle exec rake $TASK"
|
16
|
-
|
17
|
-
after_success:
|
18
|
-
- bundle exec codeclimate-test-reporter
|
19
|
-
|
20
|
-
env:
|
21
|
-
global:
|
22
|
-
- secure: "a7sD9iwPJJn3Fj+mn62GAmy/PEguh3elrilsp1KS+WfDiCiIKD8Q5KG2Jv67DGcQAGI3dPWeh7+ZhZ/W7nEipwWUBmSvGYVeoF63y8j6mNRLeekqspj94l47hXyFePj9bCadY1b1/xY4lE1pMEU8eA8AOUHUqCSuH+Kk/MuvyLM="
|
23
|
-
matrix:
|
24
|
-
- "TASK=test:core_and_plugins"
|
25
|
-
- "TASK=test:rails RAILS=6.0.0.beta2"
|
26
|
-
- "TASK=test:rails RAILS=5.2.2"
|
27
|
-
- "TASK=test:rails RAILS=5.2.1.1"
|
28
|
-
- "TASK=test:rails RAILS=5.2.1"
|
29
|
-
- "TASK=test:sinatra SINATRA=2.0.5"
|
30
|
-
- "TASK=test:sinatra SINATRA=2.0.4"
|
31
|
-
- "TASK=test:sinatra SINATRA=2.0.3"
|
32
|
-
|
33
|
-
matrix:
|
34
|
-
exclude:
|
35
|
-
- rvm: 2.4.5
|
36
|
-
env: "TASK=test:rails RAILS=6.0.0.beta2"
|
37
|
-
- rvm: jruby-9.1.17.0
|
38
|
-
env: "TASK=test:rails RAILS=6.0.0.beta2"
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = Dummy::Application.config.secret_key_base = '123a9119fb14a410f485f9390286b33f2743b9d348246cf3e4434522078f77c202d7a1fb7e42666dd0844bcb10d0ff3d8b4ee087796269d4c574837948512dbf'
|