slim 1.3.6 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +17 -5
- data/CHANGES +32 -0
- data/Gemfile +9 -1
- data/README.md +51 -32
- data/lib/slim.rb +2 -2
- data/lib/slim/code_attributes.rb +3 -3
- data/lib/slim/command.rb +4 -7
- data/lib/slim/{control_structures.rb → controls.rb} +1 -1
- data/lib/slim/{embedded_engine.rb → embedded.rb} +23 -4
- data/lib/slim/end_inserter.rb +1 -1
- data/lib/slim/engine.rb +28 -13
- data/lib/slim/filter.rb +1 -1
- data/lib/slim/logic_less/filter.rb +1 -1
- data/lib/slim/parser.rb +49 -22
- data/lib/slim/splat_attributes.rb +7 -7
- data/lib/slim/template.rb +2 -2
- data/lib/slim/translator.rb +3 -3
- data/lib/slim/version.rb +1 -1
- data/slim.gemspec +1 -8
- data/test/core/helper.rb +21 -13
- data/test/core/test_code_escaping.rb +62 -4
- data/test/core/test_code_structure.rb +42 -0
- data/test/core/test_embedded_engines.rb +79 -0
- data/test/core/test_html_attributes.rb +23 -1
- data/test/core/test_parser_errors.rb +8 -0
- data/test/core/test_pretty.rb +37 -8
- data/test/core/test_ruby_errors.rb +6 -2
- data/test/core/test_tabs.rb +169 -0
- data/test/literate/TESTS.md +26 -6
- data/test/rails/app/controllers/parents_controller.rb +1 -0
- data/test/rails/app/controllers/slim_controller.rb +1 -1
- data/test/rails/config/environments/test.rb +2 -0
- data/test/rails/config/initializers/secret_token.rb +1 -1
- data/test/rails/test/test_slim.rb +6 -2
- metadata +12 -115
- data/test/rails/config/environments/development.rb +0 -23
- data/test/rails/config/environments/production.rb +0 -49
data/test/literate/TESTS.md
CHANGED
@@ -87,7 +87,9 @@ body
|
|
87
87
|
renders as
|
88
88
|
|
89
89
|
~~~ html
|
90
|
-
<body>
|
90
|
+
<body>
|
91
|
+
Text
|
92
|
+
</body>
|
91
93
|
~~~
|
92
94
|
|
93
95
|
You can embed html code in the text which is not escaped.
|
@@ -211,7 +213,15 @@ HTML tags allow nested blocks inside.
|
|
211
213
|
renders as
|
212
214
|
|
213
215
|
~~~ html
|
214
|
-
<html><head
|
216
|
+
<html><head>
|
217
|
+
<title>
|
218
|
+
Example
|
219
|
+
</title>
|
220
|
+
</head>
|
221
|
+
<body>
|
222
|
+
yes
|
223
|
+
</body>
|
224
|
+
</html>
|
215
225
|
~~~
|
216
226
|
|
217
227
|
### Control code `-`
|
@@ -421,7 +431,9 @@ renders as
|
|
421
431
|
|
422
432
|
~~~ html
|
423
433
|
<body>
|
424
|
-
<p>
|
434
|
+
<p>
|
435
|
+
Hello!
|
436
|
+
</p>
|
425
437
|
</body>
|
426
438
|
~~~
|
427
439
|
|
@@ -448,7 +460,9 @@ renders as
|
|
448
460
|
<body>
|
449
461
|
<!--Another comment
|
450
462
|
with multiple lines-->
|
451
|
-
<p>
|
463
|
+
<p>
|
464
|
+
Hello!
|
465
|
+
</p>
|
452
466
|
<!--First line determines indentation
|
453
467
|
|
454
468
|
of the comment-->
|
@@ -465,7 +479,11 @@ renders as
|
|
465
479
|
renders as
|
466
480
|
|
467
481
|
~~~ html
|
468
|
-
<!--[if IE]
|
482
|
+
<!--[if IE]>
|
483
|
+
<p>
|
484
|
+
Get a better browser.
|
485
|
+
</p>
|
486
|
+
<![endif]-->
|
469
487
|
~~~
|
470
488
|
|
471
489
|
## HTML tags
|
@@ -959,7 +977,9 @@ h1 Welcome #{user}!
|
|
959
977
|
renders as
|
960
978
|
|
961
979
|
~~~ html
|
962
|
-
<h1>
|
980
|
+
<h1>
|
981
|
+
Welcome John Doe <john@doe.net>!
|
982
|
+
</h1>
|
963
983
|
~~~
|
964
984
|
|
965
985
|
## Embedded engines
|
@@ -23,7 +23,7 @@ class SlimController < ApplicationController
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def thread_options
|
26
|
-
Slim::Engine.with_options(:shortcut => {'@' =>
|
26
|
+
Slim::Engine.with_options(:shortcut => {'@' => { :attr => params[:attr] }}) do
|
27
27
|
render
|
28
28
|
end
|
29
29
|
end
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = '123a9119fb14a410f485f9390286b33f2743b9d348246cf3e4434522078f77c202d7a1fb7e42666dd0844bcb10d0ff3d8b4ee087796269d4c574837948512dbf'
|
7
|
+
Dummy::Application.config.secret_token = Dummy::Application.config.secret_key_base = '123a9119fb14a410f485f9390286b33f2743b9d348246cf3e4434522078f77c202d7a1fb7e42666dd0844bcb10d0ff3d8b4ee087796269d4c574837948512dbf'
|
@@ -4,7 +4,8 @@ class TestSlim < ActionDispatch::IntegrationTest
|
|
4
4
|
test "normal view" do
|
5
5
|
get "slim/normal"
|
6
6
|
assert_response :success
|
7
|
-
assert_template
|
7
|
+
assert_template "slim/normal"
|
8
|
+
assert_template "layouts/application"
|
8
9
|
assert_html "<h1>Hello Slim!</h1>"
|
9
10
|
end
|
10
11
|
|
@@ -61,7 +62,10 @@ class TestSlim < ActionDispatch::IntegrationTest
|
|
61
62
|
post "parents", 'parent[name]' => "p1", 'parent[children_attributes][0][name]' => "c1"
|
62
63
|
get "parents/1/edit"
|
63
64
|
|
64
|
-
assert_match
|
65
|
+
assert_match %r{action="/parents/1"}, @response.body
|
66
|
+
assert_match %r{<input id="parent_name" name="parent\[name\]"}, @response.body
|
67
|
+
assert_match %r{<input id="parent_children_attributes_0_name" name="parent\[children_attributes\]\[0\]\[name\]"}, @response.body
|
68
|
+
assert_match %r{<input id="parent_children_attributes_0_id" name="parent\[children_attributes\]\[0\]\[id\]"}, @response.body
|
65
69
|
end
|
66
70
|
|
67
71
|
protected
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel Mendler
|
@@ -11,28 +10,25 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-
|
13
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: temple
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ~>
|
22
20
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
21
|
+
version: 0.6.3
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.
|
28
|
+
version: 0.6.3
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: tilt
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ~>
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,107 +36,10 @@ dependencies:
|
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ~>
|
46
41
|
- !ruby/object:Gem::Version
|
47
42
|
version: 1.3.3
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rake
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
|
-
requirements:
|
53
|
-
- - ! '>='
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 0.8.7
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
|
-
requirements:
|
61
|
-
- - ! '>='
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 0.8.7
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: sass
|
66
|
-
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ! '>='
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 3.1.0
|
72
|
-
type: :development
|
73
|
-
prerelease: false
|
74
|
-
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
|
-
requirements:
|
77
|
-
- - ! '>='
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 3.1.0
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: minitest
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- - ! '>='
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
|
-
requirements:
|
93
|
-
- - ! '>='
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: kramdown
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
|
-
requirements:
|
101
|
-
- - ! '>='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - ! '>='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: creole
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
|
-
requirements:
|
117
|
-
- - ! '>='
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
|
-
requirements:
|
125
|
-
- - ! '>='
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '0'
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: builder
|
130
|
-
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
|
-
requirements:
|
133
|
-
- - ! '>='
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: '0'
|
136
|
-
type: :development
|
137
|
-
prerelease: false
|
138
|
-
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
|
-
requirements:
|
141
|
-
- - ! '>='
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '0'
|
144
43
|
description: Slim is a template language whose goal is reduce the syntax to the essential
|
145
44
|
parts without becoming cryptic.
|
146
45
|
email:
|
@@ -173,8 +72,8 @@ files:
|
|
173
72
|
- lib/slim.rb
|
174
73
|
- lib/slim/code_attributes.rb
|
175
74
|
- lib/slim/command.rb
|
176
|
-
- lib/slim/
|
177
|
-
- lib/slim/
|
75
|
+
- lib/slim/controls.rb
|
76
|
+
- lib/slim/embedded.rb
|
178
77
|
- lib/slim/end_inserter.rb
|
179
78
|
- lib/slim/engine.rb
|
180
79
|
- lib/slim/filter.rb
|
@@ -204,6 +103,7 @@ files:
|
|
204
103
|
- test/core/test_pretty.rb
|
205
104
|
- test/core/test_ruby_errors.rb
|
206
105
|
- test/core/test_slim_template.rb
|
106
|
+
- test/core/test_tabs.rb
|
207
107
|
- test/core/test_text_interpolation.rb
|
208
108
|
- test/core/test_thread_options.rb
|
209
109
|
- test/literate/TESTS.md
|
@@ -236,8 +136,6 @@ files:
|
|
236
136
|
- test/rails/config/boot.rb
|
237
137
|
- test/rails/config/database.yml
|
238
138
|
- test/rails/config/environment.rb
|
239
|
-
- test/rails/config/environments/development.rb
|
240
|
-
- test/rails/config/environments/production.rb
|
241
139
|
- test/rails/config/environments/test.rb
|
242
140
|
- test/rails/config/initializers/backtrace_silencers.rb
|
243
141
|
- test/rails/config/initializers/inflections.rb
|
@@ -253,26 +151,25 @@ files:
|
|
253
151
|
- test/translator/test_translator.rb
|
254
152
|
homepage: http://slim-lang.com/
|
255
153
|
licenses: []
|
154
|
+
metadata: {}
|
256
155
|
post_install_message:
|
257
156
|
rdoc_options: []
|
258
157
|
require_paths:
|
259
158
|
- lib
|
260
159
|
required_ruby_version: !ruby/object:Gem::Requirement
|
261
|
-
none: false
|
262
160
|
requirements:
|
263
|
-
- -
|
161
|
+
- - '>='
|
264
162
|
- !ruby/object:Gem::Version
|
265
163
|
version: '0'
|
266
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
|
-
none: false
|
268
165
|
requirements:
|
269
|
-
- -
|
166
|
+
- - '>='
|
270
167
|
- !ruby/object:Gem::Version
|
271
168
|
version: '0'
|
272
169
|
requirements: []
|
273
170
|
rubyforge_project: slim
|
274
|
-
rubygems_version:
|
171
|
+
rubygems_version: 2.0.0
|
275
172
|
signing_key:
|
276
|
-
specification_version:
|
173
|
+
specification_version: 4
|
277
174
|
summary: Slim is a template language.
|
278
175
|
test_files: []
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Show full error reports and disable caching
|
10
|
-
config.consider_all_requests_local = true
|
11
|
-
config.action_view.debug_rjs = true
|
12
|
-
config.action_controller.perform_caching = false
|
13
|
-
|
14
|
-
# Don't care if the mailer can't send
|
15
|
-
config.action_mailer.raise_delivery_errors = false
|
16
|
-
|
17
|
-
# Print deprecation notices to the Rails logger
|
18
|
-
config.active_support.deprecation = :log
|
19
|
-
|
20
|
-
# Only use best-standards-support built into browsers
|
21
|
-
config.action_dispatch.best_standards_support = :builtin
|
22
|
-
end
|
23
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
5
|
-
# Code is not reloaded between requests
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Full error reports are disabled and caching is turned on
|
9
|
-
config.consider_all_requests_local = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
|
12
|
-
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
-
|
15
|
-
# For nginx:
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
-
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
-
# just comment this out and Rails will serve the files
|
20
|
-
|
21
|
-
# See everything in the log (default is :info)
|
22
|
-
# config.log_level = :debug
|
23
|
-
|
24
|
-
# Use a different logger for distributed setups
|
25
|
-
# config.logger = SyslogLogger.new
|
26
|
-
|
27
|
-
# Use a different cache store in production
|
28
|
-
# config.cache_store = :mem_cache_store
|
29
|
-
|
30
|
-
# Disable Rails's static asset server
|
31
|
-
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
33
|
-
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
-
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
39
|
-
|
40
|
-
# Enable threaded mode
|
41
|
-
# config.threadsafe!
|
42
|
-
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
45
|
-
config.i18n.fallbacks = true
|
46
|
-
|
47
|
-
# Send deprecation notices to registered listeners
|
48
|
-
config.active_support.deprecation = :notify
|
49
|
-
end
|