haml 6.1.1 → 6.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c6e33698052b2d1823959741be8219446b8b3257f5124449daa8cd8deb70e4a
4
- data.tar.gz: d2a168766babc32a3f83b065e6d158e5b937995cdd5a46552fb95d4035ad5924
3
+ metadata.gz: e0e28e40ec5137482caae5c2fb466d21976027139b3f39d428035dbd35914774
4
+ data.tar.gz: c906550bd147f7e6a2961ebd07bc59fcc69b3433c454141cb2ae29e1ccd64e2b
5
5
  SHA512:
6
- metadata.gz: c6d71bcdb86f5281b34c9f56684263db88e947b17c8d79eb764b6ecb8f17945ad7fc374b2ad8032066b0c7ae52e3c0045de3658b76fc073e5ee8ab73e3c7eae3
7
- data.tar.gz: 408d9dd0b14378515d175778a9d9b472b70819c2371189aa145d2e787590213f453bba60e6dec2aee5aadf9e7bc0fd6c4b077f96676c9b6e899896ce60eb07cc
6
+ metadata.gz: '0583d8a879f6c7eda656d6c956a9e5573eedd5f94d14b28d378af85bbab73f220499b9c8021af0bad5946c95073cd1201d2d2765556e138696462bf2d28a4304'
7
+ data.tar.gz: 2847f03720469d3eaabcc689f628198569f668b1c87c70f67422c70ed1af25103998cc004a86d9f430d57fb12f88078ef2fa27d544dad69ad9df95cc9241bfdd
@@ -22,10 +22,11 @@ jobs:
22
22
  - '2.7'
23
23
  - '3.0'
24
24
  - '3.1'
25
+ - '3.2'
25
26
  - jruby
26
27
  - truffleruby-head
27
28
  steps:
28
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v3
29
30
  - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
30
31
  - name: Set up Ruby
31
32
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.2.3
4
+
5
+ * Resurrect RDFa doctype support [#1147](https://github.com/haml/haml/issues/1147)
6
+
7
+ ## 6.2.2
8
+
9
+ * Allow adding custom attributes to `Haml::BOOLEAN_ATTRIBUTES` [#1148](https://github.com/haml/haml/issues/1148)
10
+ * Consider `aria-xxx: false` as a boolean attribute
11
+
12
+ ## 6.2.1
13
+
14
+ * Fix v6.2.0's bug in rendering dynamic `aria` attributes [#1149](https://github.com/haml/haml/issues/1149)
15
+
16
+ ## 6.2.0
17
+
18
+ * Drop the C extension [#1146](https://github.com/haml/haml/issues/1146)
19
+
20
+ ## 6.1.4
21
+
22
+ * Let `Haml::Util.escape_html` use `ERB::Escape` if available [#1145](https://github.com/haml/haml/issues/1145)
23
+
24
+ ## 6.1.3
25
+
26
+ * Add `Haml::RailsTemplate#default_format` for Turbo compatibility [#1144](https://github.com/haml/haml/issues/1144)
27
+
28
+ ## 6.1.2
29
+
30
+ * Use the rails template path as `filename` [#1140](https://github.com/haml/haml/issues/1140)
31
+
3
32
  ## 6.1.1
4
33
 
5
34
  * Fix an empty output of Ruby 3.1's Hash shorthand syntax [#1083](https://github.com/haml/haml/issues/1083)
@@ -100,6 +129,14 @@ Released on September 21, 2022
100
129
  * Removed: `block_is_haml?`, `capture_haml`, `escape_once`, `find_and_preserve`, `flatten`, `haml_concat`,
101
130
  `haml_indent`, `haml_tag`, `haml_tag_if`, `html_attrs`, `html_escape`, `init_haml_helpers`, `is_haml?`,
102
131
  `list_of`, `non_haml`, `precede`, `succeed`, `surround`, `tab_down`, `tab_up`, `with_tabs`
132
+ * `:ruby` filter
133
+ * Removed: `haml_io`
134
+ * Alternatives to the removed helpers:
135
+ * Some simple ones could work by copying [the original definition](https://github.com/haml/haml/blob/v5.2.2/lib/haml/helpers.rb).
136
+ * For helpers generating general HTML tags, also consider using what your framework provides, e.g. Rails `content_tag`.
137
+ Same applies to `capture_haml`, e.g. Rails `capture`.
138
+ * Ones that rely on `Haml::Buffer` have no direct alternative by design. They existed at the cost of performance.
139
+ You need to define a helper, instantiate a String buffer in it, append stuff to it, and call it inside `=`.
103
140
  * Only the following attributes and `aria`/`data` attributes are considered boolean attributes:
104
141
  * `allowfullscreen`, `async`, `autobuffer`, `autofocus`, `autoplay`, `checked`, `controls`, `default`,
105
142
  `defer`, `disabled`, `download`, `formnovalidate`, `hidden`, `inert`, `ismap`, `itemscope`, `loop`,
@@ -1424,7 +1461,7 @@ Haml 2.2 introduces a new syntax for attributes
1424
1461
  based on the HTML syntax.
1425
1462
  For example:
1426
1463
 
1427
- %a(href="http://haml.info" title="Haml's so cool!")
1464
+ %a(href="https://haml.info" title="Haml's so cool!")
1428
1465
  %img(src="/images/haml.png" alt="Haml")
1429
1466
 
1430
1467
  There are two main reasons for this.
data/FAQ.md CHANGED
@@ -141,7 +141,7 @@ For other plugins, a little searching will probably turn up a way to fix them as
141
141
 
142
142
  ## You still haven't answered my question!
143
143
 
144
- Sorry! Try looking at the [Haml](http://haml.info/docs/yardoc/file.REFERENCE.html) reference,
144
+ Sorry! Try looking at the [Haml](https://haml.info/docs/yardoc/file.REFERENCE.html) reference,
145
145
  If you can't find an answer there,
146
146
  feel free to ask in `#haml` on irc.freenode.net
147
147
  or send an email to the [mailing list](http://groups.google.com/group/haml).
data/Gemfile CHANGED
@@ -21,3 +21,7 @@ else
21
21
  gem 'stackprof'
22
22
  end
23
23
  end
24
+
25
+ if RUBY_VERSION < '2.6'
26
+ gem 'rake-compiler', '< 1.2.4'
27
+ end
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Haml
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
3
+ [![Gem Version](https://badge.fury.io/rb/haml.svg)](https://rubygems.org/gems/haml)
4
4
  [![test](https://github.com/haml/haml/actions/workflows/test.yml/badge.svg)](https://github.com/haml/haml/actions/workflows/test.yml)
5
5
  [![Code Climate](https://codeclimate.com/github/haml/haml/badges/gpa.svg)](https://codeclimate.com/github/haml/haml)
6
- [![Inline docs](http://inch-ci.org/github/haml/haml.png)](http://inch-ci.org/github/haml/haml)
6
+ [![Inline docs](https://inch-ci.org/github/haml/haml.svg)](https://inch-ci.org/github/haml/haml)
7
7
 
8
8
  Haml is a templating engine for HTML. It's designed to make it both easier and
9
9
  more pleasant to write HTML documents, by eliminating redundancy, reflecting the
@@ -31,7 +31,7 @@ to compile it to HTML. For more information on these commands, check out
31
31
  haml --help
32
32
  ~~~
33
33
 
34
- To use Haml programmatically, check out the [YARD documentation](http://haml.info/docs/yardoc/).
34
+ To use Haml programmatically, check out the [YARD documentation](https://haml.info/docs/yardoc/).
35
35
 
36
36
  ## Using Haml with Rails
37
37
 
@@ -120,7 +120,7 @@ output the result. You can even use control statements like `if` and `while`:
120
120
  ~~~
121
121
 
122
122
  Haml provides far more tools than those presented here. Check out the [reference
123
- documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
123
+ documentation](https://haml.info/docs/yardoc/file.REFERENCE.html)
124
124
  for full details.
125
125
 
126
126
  ### Indentation
@@ -132,7 +132,7 @@ can't be mixed, and the same number of tabs or spaces must be used throughout.
132
132
  ## Contributing
133
133
 
134
134
  Contributions are welcomed, but before you get started please read the
135
- [guidelines](http://haml.info/development.html#contributing).
135
+ [guidelines](https://haml.info/development.html#contributing).
136
136
 
137
137
  After forking and then cloning the repo locally, install Bundler and then use it
138
138
  to install the development gem dependencies:
@@ -182,7 +182,7 @@ but still consults on language issues.
182
182
  [Natalie Weizenbaum](http://nex-3.com) was for many years the primary developer
183
183
  and architect of the "modern" Ruby implementation of Haml.
184
184
 
185
- [Norman Clarke](http://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
185
+ [Norman Clarke](https://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
186
186
 
187
187
  ## License
188
188
 
data/REFERENCE.md CHANGED
@@ -180,10 +180,10 @@ closing tags for any element.
180
180
 
181
181
  ### Attributes: `{}` or `()` {#attributes}
182
182
 
183
- Brackets represent a Ruby hash that is used for specifying the attributes of an
183
+ Braces represent a Ruby hash that is used for specifying the attributes of an
184
184
  element. It is literally evaluated as a Ruby hash, so logic will work in it and
185
185
  local variables may be used. Quote characters within the attribute will be
186
- replaced by appropriate escape sequences. The hash is placed after the tag is
186
+ replaced with appropriate escape sequences. The hash is placed after the tag is
187
187
  defined. For example:
188
188
 
189
189
  %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
@@ -247,7 +247,7 @@ could render as either of:
247
247
  #### HTML-style Attributes: `()`
248
248
 
249
249
  Haml also supports a terser, less Ruby-specific attribute syntax based on HTML's
250
- attributes. These are used with parentheses instead of brackets, like so:
250
+ attributes. These are used with parentheses instead of braces, like so:
251
251
 
252
252
  %html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en")
253
253
 
@@ -320,7 +320,7 @@ or using `true` and `false`:
320
320
  %input(selected=true)
321
321
 
322
322
  This feature works only for attributes that are included in
323
- [`Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES`](lib/haml/attribute_builder.rb),
323
+ [`Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES`](https://github.com/haml/haml/blob/main/lib/haml/attribute_builder.rb#L5),
324
324
  as well as `data-` and `aria-` attributes.
325
325
 
326
326
  %input{'data-hidden' => false}
@@ -360,7 +360,7 @@ will render as:
360
360
 
361
361
  <a data-author-id='123' data-category='7' href='/posts'>Posts By Author</a>
362
362
 
363
- Notice that the underscore in `author_id` was replaced by a hyphen. If you wish
363
+ Notice that the underscore in `author_id` was replaced with a hyphen. If you wish
364
364
  to suppress this behavior, you can set Haml's
365
365
  {Haml::Options#hyphenate_data_attrs `:hyphenate_data_attrs` option} to `false`,
366
366
  and the output will be rendered as:
@@ -992,7 +992,7 @@ most code but you may have errors with code like the following:
992
992
 
993
993
  %span #{'{'}
994
994
 
995
- This code will generate a syntax error, complaining about unbalanced brackets.
995
+ This code will generate a syntax error, complaining about unbalanced braces.
996
996
  In cases like this, the recommended workaround is output the code as a Ruby
997
997
  string to force Haml to parse the code with Ruby.
998
998
 
@@ -1093,7 +1093,7 @@ uses to implement many of its filters:
1093
1093
 
1094
1094
  Tilt.prefer Tilt::RedCarpetTemplate
1095
1095
 
1096
- See the [Tilt documentation](https://github.com/rtomayko/tilt#fallback-mode) for
1096
+ See the [Tilt documentation](https://github.com/rtomayko/tilt) for
1097
1097
  more info.
1098
1098
 
1099
1099
  Haml comes with the following filters defined:
@@ -1145,7 +1145,7 @@ implemented using Tilt.
1145
1145
 
1146
1146
  ### `:maruku` {#maruku-filter}
1147
1147
 
1148
- Parses the filtered text with [Maruku](https://github.com/nex3/maruku), which
1148
+ Parses the filtered text with [Maruku](https://github.com/bhollis/maruku), which
1149
1149
  has some non-standard extensions to Markdown.
1150
1150
 
1151
1151
  As of Haml 4.0, this filter is defined in [Haml
@@ -1168,11 +1168,8 @@ HTML escape code for newlines, to preserve nice-looking output. See also
1168
1168
 
1169
1169
  ### `:ruby` {#ruby-filter}
1170
1170
 
1171
- Parses the filtered text with the normal Ruby interpreter. Creates an `IO`
1172
- object named `haml_io`, anything written to it is output into the Haml document.
1173
- Not available if the {Haml::Options#suppress_eval `:suppress_eval`} option is
1174
- set to true. The Ruby code is evaluated in the same context as the Haml
1175
- template.
1171
+ Parses the filtered text with the normal Ruby interpreter.
1172
+ The Ruby code is evaluated in the same context as the Haml template.
1176
1173
 
1177
1174
  ### `:sass` {#sass-filter}
1178
1175
 
@@ -1203,40 +1200,36 @@ You can also define your own filters.
1203
1200
 
1204
1201
  The simplest example of a filter might be something like:
1205
1202
 
1206
- ```ruby
1207
- class HelloFilter < Haml::Filters::Base
1208
- def compile(_node)
1209
- [:static, "hello world"]
1210
- end
1211
- end
1212
-
1213
- Haml::Filters.registered[:hello] ||= HelloFilter
1214
- ```
1215
-
1216
- A more complex complex example
1217
-
1218
- ```ruby
1219
- class BetterFilter < Haml::Filters::Base
1220
- def compile(node)
1221
- temple = [:multi]
1222
- temple << [:static, "hello "]
1223
- temple << compile_text(node.value[:text])
1224
- temple << [:static, " world"]
1225
- temple
1226
- end
1227
-
1228
- private
1229
- def compile_text(text)
1230
- if ::Haml::Util.contains_interpolation?(text)
1231
- [:dynamic, ::Haml::Util.unescape_interpolation(text)]
1232
- else
1233
- [:static, text]
1203
+ class HelloFilter < Haml::Filters::Base
1204
+ def compile(_node)
1205
+ [:static, "hello world"]
1206
+ end
1207
+ end
1208
+
1209
+ Haml::Filters.registered[:hello] ||= HelloFilter
1210
+
1211
+ A more complex example:
1212
+
1213
+ class BetterFilter < Haml::Filters::Base
1214
+ def compile(node)
1215
+ temple = [:multi]
1216
+ temple << [:static, "hello "]
1217
+ temple << compile_text(node.value[:text])
1218
+ temple << [:static, " world"]
1219
+ temple
1220
+ end
1221
+
1222
+ private
1223
+ def compile_text(text)
1224
+ if ::Haml::Util.contains_interpolation?(text)
1225
+ [:dynamic, ::Haml::Util.unescape_interpolation(text)]
1226
+ else
1227
+ [:static, text]
1228
+ end
1229
+ end
1234
1230
  end
1235
- end
1236
- end
1237
1231
 
1238
- Haml::Filters.registered[:better] ||= BetterFilter
1239
- ```
1232
+ Haml::Filters.registered[:better] ||= BetterFilter
1240
1233
 
1241
1234
  See {Haml::Filters} for examples.
1242
1235
 
@@ -1285,7 +1278,7 @@ can be wrapped over multiple lines,
1285
1278
  as long as each line but the last ends in a comma
1286
1279
  (see [Inserting Ruby](#inserting_ruby)).
1287
1280
 
1288
- ## Whitespace Preservation
1281
+ ## Whitespace Preservation {#whitespace_preservation}
1289
1282
 
1290
1283
  Sometimes you don't want Haml to indent all your text.
1291
1284
  For example, tags like `pre` and `textarea` are whitespace-sensitive;
data/Rakefile CHANGED
@@ -1,39 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
-
3
- #
4
- # Prepend DevKit into compilation phase
5
- #
6
- if Gem.win_platform?
7
- desc 'Activates DevKit'
8
- task :devkit do
9
- begin
10
- require 'devkit'
11
- rescue LoadError
12
- abort 'Failed to load DevKit required for compilation'
13
- end
14
- end
15
- task compile: :devkit
16
- end
17
-
18
2
  require 'rake/testtask'
19
- if /java/ === RUBY_PLATFORM
20
- # require 'rake/javaextensiontask'
21
- # Rake::JavaExtensionTask.new(:haml) do |ext|
22
- # ext.ext_dir = 'ext/java'
23
- # ext.lib_dir = 'lib/haml'
24
- # end
25
-
26
- task :compile do
27
- # dummy for now
28
- end
29
- else
30
- require 'rake/extensiontask'
31
- Rake::ExtensionTask.new(:haml) do |ext|
32
- ext.lib_dir = 'lib/haml'
33
- end
34
- end
35
-
36
- Dir['benchmark/*.rake'].each { |b| import(b) }
37
3
 
38
4
  Rake::TestTask.new do |t|
39
5
  t.libs << 'lib' << 'test'
@@ -42,10 +8,10 @@ Rake::TestTask.new do |t|
42
8
  t.test_files = files
43
9
  t.verbose = true
44
10
  end
45
- task test: :compile
11
+ task :test
46
12
 
47
13
  desc 'bench task for CI'
48
- task bench: :compile do
14
+ task :bench do
49
15
  if ENV['SLIM_BENCH'] == '1'
50
16
  cmd = %w[bundle exec ruby benchmark/slim/run-benchmarks.rb]
51
17
  else
@@ -79,4 +45,4 @@ task(:doc => 'doc:sass') {sh "yard"}
79
45
  desc "Generate documentation incrementally"
80
46
  task(:redoc) {sh "yard -c"}
81
47
 
82
- task default: %w[compile test]
48
+ task default: :test
data/haml.gemspec CHANGED
@@ -19,12 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- if /java/ === RUBY_PLATFORM
23
- spec.platform = 'java'
24
- else
25
- spec.extensions = ['ext/haml/extconf.rb']
26
- spec.required_ruby_version = '>= 2.1.0'
27
- end
22
+ spec.metadata = { 'rubygems_mfa_required' => 'true' }
23
+
24
+ spec.required_ruby_version = '>= 2.1.0'
28
25
 
29
26
  spec.add_dependency 'temple', '>= 0.8.2'
30
27
  spec.add_dependency 'thor'
@@ -39,7 +36,6 @@ Gem::Specification.new do |spec|
39
36
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
40
37
  spec.add_development_dependency 'rails', '>= 4.0'
41
38
  spec.add_development_dependency 'rake'
42
- spec.add_development_dependency 'rake-compiler'
43
39
  spec.add_development_dependency 'sass'
44
40
  spec.add_development_dependency 'slim'
45
41
  spec.add_development_dependency 'string_template'