slim 4.0.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-lang.com">slim-lang.com</a>
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-lang.com">slim-lang.com</a>
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-lang.com" slim-lang.com
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-lang.com">slim-lang.com</a>
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-lang.com">slim-lang.com</a>
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-lang.com">slim-lang.com</a>
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.
@@ -368,7 +368,7 @@ You don't need the explicit `\` if the line ends with a comma `,`.
368
368
 
369
369
  ~~~ slim
370
370
  ruby:
371
- def test(*args)
371
+ def self.test(*args)
372
372
  args.join('-')
373
373
  end
374
374
  = test('arg1',
@@ -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-lang.com" class="important") Link
803
+ a(href="http://github.com/slim-template/slim" class="important") Link
804
804
  li
805
- a[href="http://slim-lang.com" class="important"] Link
805
+ a[href="http://github.com/slim-template/slim" class="important"] Link
806
806
  li
807
- a{href="http://slim-lang.com" class="important"} Link
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-lang.com">Link</a>
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-lang.com">Link</a>
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-lang.com">Link</a>
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-lang.com"
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-lang.com">Link</a>
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-lang.com" title='Slim Homepage' Goto the Slim homepage
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-lang.com" title="Slim Homepage">Goto the Slim homepage</a>
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-lang.com'
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-lang.com">Goto the slim-lang.com</a><a href="{&quot;test&quot;}">Test of quoted text in braces</a>
895
+ <a href="http://github.com/slim-template/slim">Goto the github.com/slim-template/slim</a><a href="{&quot;test&quot;}">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.
@@ -961,7 +961,7 @@ You don't need the explicit `\` if the line ends with a comma `,`.
961
961
 
962
962
  ~~~ slim
963
963
  ruby:
964
- def test(*args)
964
+ def self.test(*args)
965
965
  args.join('-')
966
966
  end
967
967
  a href=test('arg1',
@@ -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://slim-lang.com/" Slim-lang.com
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://slim-lang.com/">Slim-lang.com</a>
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.
@@ -1073,8 +1073,8 @@ with the :tag key.
1073
1073
 
1074
1074
  ~~~ slim
1075
1075
  ruby:
1076
- def a_unless_current
1077
- @page_current ? {tag: 'span'} : {tag: 'a', href: 'http://slim-lang.com/'}
1076
+ def self.a_unless_current
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://slim-lang.com/">Link</a>
1088
+ <span>Link</span><a href="http://github.com/slim-template/slim/">Link</a>
1089
1089
  ~~~
1090
1090
 
1091
1091
  ### Shortcuts
@@ -1186,13 +1186,15 @@ renders to
1186
1186
 
1187
1187
  #### ID shortcut and class shortcut `.`
1188
1188
 
1189
- ID and class shortcuts can contain dashes.
1189
+ ID and class shortcuts can contain dashes, slashes with digits, and colons.
1190
1190
 
1191
1191
  ~~~ slim
1192
1192
  .-test text
1193
1193
  #test- text
1194
1194
  .--a#b- text
1195
1195
  .a--test-123#--b text
1196
+ .a-1/2#b-1/2 text
1197
+ .ab:c-test#d:e text
1196
1198
  ~~~
1197
1199
 
1198
1200
  renders as
@@ -1210,6 +1212,12 @@ renders as
1210
1212
  <div class="a--test-123" id="--b">
1211
1213
  text
1212
1214
  </div>
1215
+ <div class="a-1/2" id="b-1/2">
1216
+ text
1217
+ </div>
1218
+ <div class="ab:c-test" id="d:e">
1219
+ text
1220
+ </div>
1213
1221
  ~~~
1214
1222
 
1215
1223
  ## Text interpolation
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
 
@@ -0,0 +1 @@
1
+ // file required by sprockets >= 4.0
@@ -5,8 +5,7 @@ require 'action_controller/railtie'
5
5
  require 'action_view/railtie'
6
6
  #require 'active_record/railtie'
7
7
  #require 'action_mailer/railtie'
8
- require "sprockets/railtie"
9
-
8
+ require 'sprockets/railtie'
10
9
  require 'slim'
11
10
 
12
11
  module Dummy
@@ -41,20 +40,5 @@ module Dummy
41
40
 
42
41
  # Configure sensitive parameters which will be filtered from the log file.
43
42
  config.filter_parameters += [:password]
44
-
45
- # From slim-rails fix for "ActionView::Template::Error: Unknown line indicator"
46
- # https://github.com/slim-template/slim-rails/blob/991589ea5648e5e896781e68912bc51beaf4102a/lib/slim-rails/register_engine.rb
47
- if config.respond_to?(:assets)
48
- config.assets.configure do |env|
49
- if env.respond_to?(:register_transformer) && Sprockets::VERSION.to_i > 3
50
- env.register_mime_type 'text/slim', extensions: ['.slim', '.slim.html']
51
- env.register_transformer 'text/slim', 'text/html', RegisterEngine::Transformer
52
- elsif env.respond_to?(:register_engine)
53
- args = ['.slim', Slim::Template]
54
- args << { silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
55
- env.register_engine(*args)
56
- end
57
- end
58
- end
59
43
  end
60
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
- if RUBY_ENGINE == 'jruby' && RUBY_ENGINE < '2.2.0'
50
- puts 'Streaming test disabled for JRuby < 9000.',
51
- 'See https://github.com/jruby/jruby/issues/1243',
52
- 'and https://github.com/jruby/jruby/issues/1789'
53
- else
54
- puts 'Streaming test enabled.'
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"
@@ -8,8 +8,6 @@ if ENV['COVERAGE']
8
8
  end
9
9
 
10
10
  ENV['APP_ENV'] = 'test'
11
- Encoding.default_external = "UTF-8" if defined? Encoding
12
-
13
11
  RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
14
12
 
15
13
  require 'rack'
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.0.1
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: 2018-09-02 00:00:00.000000000 Z
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: '0.9'
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: '0.9'
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
@@ -148,6 +143,7 @@ files:
148
143
  - test/literate/run.rb
149
144
  - test/logic_less/test_logic_less.rb
150
145
  - test/rails/Rakefile
146
+ - test/rails/app/assets/config/manifest.js
151
147
  - test/rails/app/controllers/application_controller.rb
152
148
  - test/rails/app/controllers/entries_controller.rb
153
149
  - test/rails/app/controllers/slim_controller.rb
@@ -176,7 +172,6 @@ files:
176
172
  - test/rails/config/initializers/backtrace_silencers.rb
177
173
  - test/rails/config/initializers/inflections.rb
178
174
  - test/rails/config/initializers/mime_types.rb
179
- - test/rails/config/initializers/secret_token.rb
180
175
  - test/rails/config/initializers/session_store.rb
181
176
  - test/rails/config/locales/en.yml
182
177
  - test/rails/config/routes.rb
@@ -194,7 +189,7 @@ files:
194
189
  - test/sinatra/views/layout2.slim
195
190
  - test/smart/test_smart_text.rb
196
191
  - test/translator/test_translator.rb
197
- homepage: http://slim-lang.com/
192
+ homepage: http://github.com/slim-template/slim/
198
193
  licenses:
199
194
  - MIT
200
195
  metadata: {}
@@ -206,15 +201,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
201
  requirements:
207
202
  - - ">="
208
203
  - !ruby/object:Gem::Version
209
- version: 2.0.0
204
+ version: 2.5.0
210
205
  required_rubygems_version: !ruby/object:Gem::Requirement
211
206
  requirements:
212
207
  - - ">="
213
208
  - !ruby/object:Gem::Version
214
209
  version: '0'
215
210
  requirements: []
216
- rubyforge_project:
217
- rubygems_version: 2.7.6
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,35 +0,0 @@
1
- # https://www.ruby-lang.org/en/downloads/releases/
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- - 2.5.0
6
- - 2.4.4
7
- - 2.4.3
8
- - jruby-9.2.0.0
9
- - jruby-9.1.17.0
10
-
11
- # Recommend sudo required when using trusty dist
12
- # https://docs.travis-ci.com/user/reference/trusty/
13
- sudo: required
14
- dist: trusty
15
-
16
- script: "bundle exec rake $TASK"
17
-
18
- after_success:
19
- - bundle exec codeclimate-test-reporter
20
-
21
- env:
22
- global:
23
- # travis encrypt CODECLIMATE_REPO_TOKEN=???
24
- - secure: "a7sD9iwPJJn3Fj+mn62GAmy/PEguh3elrilsp1KS+WfDiCiIKD8Q5KG2Jv67DGcQAGI3dPWeh7+ZhZ/W7nEipwWUBmSvGYVeoF63y8j6mNRLeekqspj94l47hXyFePj9bCadY1b1/xY4lE1pMEU8eA8AOUHUqCSuH+Kk/MuvyLM="
25
- matrix:
26
- - "TASK=test:core_and_plugins"
27
- - "TASK=test:rails RAILS=5.2.0"
28
- - "TASK=test:rails RAILS=5.1.6"
29
- - "TASK=test:sinatra SINATRA=2.0.1"
30
- - "TASK=test:sinatra SINATRA=1.4.8"
31
- - "TASK=bench"
32
- - "TASK=bench slow=1"
33
-
34
- notifications:
35
- irc: "chat.freenode.net#slim-lang"
@@ -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'