haml 6.1.0 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -1
- data/.github/workflows/test.yml +2 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +4 -0
- data/README.md +1 -1
- data/REFERENCE.md +12 -15
- data/haml.gemspec +2 -0
- data/lib/haml/attribute_compiler.rb +1 -1
- data/lib/haml/rails_template.rb +5 -0
- data/lib/haml/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f721367f32b443559aa0aa20e75bd7b9d179fffbfff06873cca328f26ae70689
|
4
|
+
data.tar.gz: dc52332427ab542277bb52374e6c20ba696180caad8a86cd04eee247c6c0f9bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13197f48f55be37cec0eb76bc6b9c2e32d37cc1b3e430a509bb9c362fbb1e8f44fb858f1d39b22a0b2c654dfb6b2c237756a08a4495cf31c42eae59a6ea15c77
|
7
|
+
data.tar.gz: 073bc4c02899dea76c285bb8561df5631e3553fc3d939e30f94fe1671814ca5c3c812c3bcec251b3f0a562c03a2db606ef9b7e37b3014c50638cf2e29c44c465
|
data/.github/FUNDING.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -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@
|
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,9 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 6.1.1
|
4
|
+
|
5
|
+
* Fix an empty output of Ruby 3.1's Hash shorthand syntax [#1083](https://github.com/haml/haml/issues/1083)
|
6
|
+
|
3
7
|
## 6.1.0
|
4
8
|
|
5
9
|
* Optimize away a `to_s` call on `=` scripts
|
@@ -96,6 +100,8 @@ Released on September 21, 2022
|
|
96
100
|
* Removed: `block_is_haml?`, `capture_haml`, `escape_once`, `find_and_preserve`, `flatten`, `haml_concat`,
|
97
101
|
`haml_indent`, `haml_tag`, `haml_tag_if`, `html_attrs`, `html_escape`, `init_haml_helpers`, `is_haml?`,
|
98
102
|
`list_of`, `non_haml`, `precede`, `succeed`, `surround`, `tab_down`, `tab_up`, `with_tabs`
|
103
|
+
* `:ruby` filter
|
104
|
+
* Removed: `haml_io`
|
99
105
|
* Only the following attributes and `aria`/`data` attributes are considered boolean attributes:
|
100
106
|
* `allowfullscreen`, `async`, `autobuffer`, `autofocus`, `autoplay`, `checked`, `controls`, `default`,
|
101
107
|
`defer`, `disabled`, `download`, `formnovalidate`, `hidden`, `inert`, `ismap`, `itemscope`, `loop`,
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/haml.svg)](http://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](
|
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
|
data/REFERENCE.md
CHANGED
@@ -180,10 +180,10 @@ closing tags for any element.
|
|
180
180
|
|
181
181
|
### Attributes: `{}` or `()` {#attributes}
|
182
182
|
|
183
|
-
|
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
|
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
|
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
|
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
|
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
|
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/
|
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.
|
1172
|
-
|
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
|
|
@@ -1213,7 +1210,7 @@ end
|
|
1213
1210
|
Haml::Filters.registered[:hello] ||= HelloFilter
|
1214
1211
|
```
|
1215
1212
|
|
1216
|
-
A more complex
|
1213
|
+
A more complex example:
|
1217
1214
|
|
1218
1215
|
```ruby
|
1219
1216
|
class BetterFilter < Haml::Filters::Base
|
@@ -1285,7 +1282,7 @@ can be wrapped over multiple lines,
|
|
1285
1282
|
as long as each line but the last ends in a comma
|
1286
1283
|
(see [Inserting Ruby](#inserting_ruby)).
|
1287
1284
|
|
1288
|
-
## Whitespace Preservation
|
1285
|
+
## Whitespace Preservation {#whitespace_preservation}
|
1289
1286
|
|
1290
1287
|
Sometimes you don't want Haml to indent all your text.
|
1291
1288
|
For example, tags like `pre` and `textarea` are whitespace-sensitive;
|
data/haml.gemspec
CHANGED
@@ -19,6 +19,8 @@ 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
|
+
spec.metadata = { 'rubygems_mfa_required' => 'true' }
|
23
|
+
|
22
24
|
if /java/ === RUBY_PLATFORM
|
23
25
|
spec.platform = 'java'
|
24
26
|
else
|
@@ -19,7 +19,7 @@ module Haml
|
|
19
19
|
end
|
20
20
|
[node.value[:dynamic_attributes].new, node.value[:dynamic_attributes].old].compact.each do |attribute_str|
|
21
21
|
hash = AttributeParser.parse(attribute_str)
|
22
|
-
return runtime_compile(node)
|
22
|
+
return runtime_compile(node) if hash.nil? || hash.any? { |_key, value| value.empty? }
|
23
23
|
hashes << hash
|
24
24
|
end
|
25
25
|
static_compile(node.value[:attributes], hashes)
|
data/lib/haml/rails_template.rb
CHANGED
@@ -27,6 +27,11 @@ module Haml
|
|
27
27
|
source ||= template.source
|
28
28
|
options = RailsTemplate.options
|
29
29
|
|
30
|
+
# Make the filename available in parser etc.
|
31
|
+
if template.respond_to?(:identifier)
|
32
|
+
options = options.merge(filename: template.identifier)
|
33
|
+
end
|
34
|
+
|
30
35
|
# https://github.com/haml/haml/blob/4.0.7/lib/haml/template/plugin.rb#L19-L20
|
31
36
|
# https://github.com/haml/haml/blob/4.0.7/lib/haml/options.rb#L228
|
32
37
|
if template.respond_to?(:type) && template.type == 'text/xml'
|
data/lib/haml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2023-08-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: temple
|
@@ -339,7 +339,8 @@ files:
|
|
339
339
|
homepage: https://haml.info
|
340
340
|
licenses:
|
341
341
|
- MIT
|
342
|
-
metadata:
|
342
|
+
metadata:
|
343
|
+
rubygems_mfa_required: 'true'
|
343
344
|
post_install_message:
|
344
345
|
rdoc_options: []
|
345
346
|
require_paths:
|
@@ -355,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
356
|
- !ruby/object:Gem::Version
|
356
357
|
version: '0'
|
357
358
|
requirements: []
|
358
|
-
rubygems_version: 3.4.
|
359
|
+
rubygems_version: 3.4.1
|
359
360
|
signing_key:
|
360
361
|
specification_version: 4
|
361
362
|
summary: An elegant, structured (X)HTML/XML templating engine.
|