haml 6.0.9-java → 6.0.11-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf3024cbd0b46fe984ac29b35e28ee37e11e6a2796c7546f752a3a7d57d2cdce
4
- data.tar.gz: 6370e9ca1ccf508cd364f20d0a14fe04fe10b0348f7632d8ac576c935e253fea
3
+ metadata.gz: 31849c95695d5db575f824528a49044c948bd030c9716a38d94db197269079ce
4
+ data.tar.gz: 931c560f376df2ba100ae8524e345807e990303fdb6b8cc8f6a8a37a3b761dd5
5
5
  SHA512:
6
- metadata.gz: bfeae6a7b54f63d8d6bdd614e382d9203b6eea8d5885a1f532919ee4008219db7777858dc911b0409d9426e7e6fd83fb4e9e39b49e0562842440d5af0a346553
7
- data.tar.gz: 6a0cc2a0ccbac7277837ecd62c6274127006ccd3509fca28dff380d8d3546ac785a7876a4a3c498c524e048f36941fcfe5a69597d65c8971a3826f1f52e07ec9
6
+ metadata.gz: a064605dc7436fa9cb8bbb143c029cf37cc25c9c5ff2ece1d5225c4b0c5ef54f4314bc014f71550d66f26dd8a64ce800553642a94263488719d60856efcb6b74
7
+ data.tar.gz: 8a61fafa65f148a3548feddc7e65a801ce75f08f1ac256a4a5e2bf1d7940ff6a6016b4b6d13d3c4228ab96e3980b63e07a9fcd3bcffcba2fcc7ac8253d3c49e3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.0.11
4
+
5
+ * Fix a whitespace removal with `>` and an `if` statement [#1114](https://github.com/haml/haml/issues/1114)
6
+
7
+ ## 6.0.10
8
+
9
+ * Evaluate :erb filter in the template context like Haml 5
10
+
3
11
  ## 6.0.9
4
12
 
5
13
  * Support sass-embedded [#1112](https://github.com/haml/haml/issues/1112)
@@ -91,6 +99,7 @@ Released on September 21, 2022
91
99
  * `-` script lines no longer support capturing. Only `=` lines are supported to yield a nested block.
92
100
  * Overriding `data` attributes with another falsy `data-*` attribute that has the same name
93
101
  is no longer supported. [#1105](https://github.com/haml/haml/issues/1105)
102
+ * :erb filter is not executed in the template context (fixed in 6.0.10)
94
103
 
95
104
  ## 5.2.2
96
105
 
data/REFERENCE.md CHANGED
@@ -338,20 +338,19 @@ will render as:
338
338
  <a> tag is so old links to here still work. -->
339
339
  <a id="html5_custom_data_attributes" style="border:0;"></a>
340
340
 
341
- #### Prefixed Attributes
341
+ #### Data Attributes
342
342
 
343
343
  HTML5 allows for adding
344
344
  [custom non-visible data attributes](http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
345
345
  to elements using attribute names beginning with `data-`. The
346
346
  [Accessible Rich Internet Applications](http://www.w3.org/WAI/intro/aria)
347
- specification makes use of attributes beginning with `aria-`. There are also
348
- frameworks that use non-standard attributes with a common prefix.
347
+ specification makes use of attributes beginning with `aria-`.
349
348
 
350
349
  Haml can help generate collections of attributes that share a prefix like
351
- these. Any entry in an attribute hash that has a Hash as its value is expanded
352
- into a series of attributes, one for each key/value pair in the hash, with the
353
- attribute name formed by joining the “parent” key name to the key name with a
354
- hyphen.
350
+ these. Any entry in an `data` or `aria` attribute hash that has a Hash as its
351
+ value is expanded into a series of attributes, one for each key/value pair in
352
+ the hash, with the attribute name formed by joining the “parent” key name to
353
+ the key name with a hyphen. This works only for `data` or `aria`.
355
354
 
356
355
  For example:
357
356
 
@@ -12,15 +12,15 @@ module Haml
12
12
  temple = [:multi]
13
13
  return temple if node.children.empty?
14
14
 
15
- temple << :whitespace if prepend_whitespace?(node)
15
+ temple << [:whitespace] if prepend_whitespace?(node)
16
16
  node.children.each do |n|
17
17
  rstrip_whitespace!(temple) if nuke_prev_whitespace?(n)
18
18
  insert_newlines!(temple, n)
19
19
  temple << moving_lineno(n) { block.call(n) }
20
- temple << :whitespace if insert_whitespace?(n)
20
+ temple << [:whitespace] if insert_whitespace?(n)
21
21
  end
22
22
  rstrip_whitespace!(temple) if nuke_inner_whitespace?(node)
23
- confirm_whitespace(temple)
23
+ temple
24
24
  end
25
25
 
26
26
  private
@@ -56,17 +56,6 @@ module Haml
56
56
  temple
57
57
  end
58
58
 
59
- def confirm_whitespace(temple)
60
- temple.map do |exp|
61
- case exp
62
- when :whitespace
63
- [:static, "\n"]
64
- else
65
- exp
66
- end
67
- end
68
- end
69
-
70
59
  def prepend_whitespace?(node)
71
60
  return false unless %i[comment tag].include?(node.type)
72
61
  !nuke_inner_whitespace?(node)
@@ -100,8 +89,14 @@ module Haml
100
89
  end
101
90
 
102
91
  def rstrip_whitespace!(temple)
103
- if temple[-1] == :whitespace
104
- temple.delete_at(-1)
92
+ case temple[0]
93
+ when :multi, :block
94
+ case temple[-1][0]
95
+ when :multi, :block
96
+ rstrip_whitespace!(temple[-1])
97
+ when :whitespace
98
+ temple.delete_at(-1)
99
+ end
105
100
  end
106
101
  end
107
102
 
data/lib/haml/engine.rb CHANGED
@@ -8,6 +8,7 @@ require 'haml/escapable'
8
8
  require 'haml/force_escapable'
9
9
  require 'haml/dynamic_merger'
10
10
  require 'haml/ambles'
11
+ require 'haml/whitespace'
11
12
 
12
13
  module Haml
13
14
  class Engine < Temple::Engine
@@ -36,6 +37,7 @@ module Haml
36
37
  filter :ControlFlow
37
38
  use Ambles
38
39
  filter :MultiFlattener
40
+ use Whitespace
39
41
  filter :StaticMerger
40
42
  use DynamicMerger
41
43
  use :Generator, -> { options[:generator] }
@@ -3,7 +3,7 @@ module Haml
3
3
  class Filters
4
4
  class Erb < TiltBase
5
5
  def compile(node)
6
- compile_with_tilt(node, 'erb')
6
+ precompiled_with_tilt(node, 'erb')
7
7
  end
8
8
  end
9
9
  end
@@ -21,6 +21,12 @@ module Haml
21
21
 
22
22
  private
23
23
 
24
+ # TODO: support interpolation
25
+ def precompiled_with_tilt(node, name)
26
+ src = ::Tilt["t.#{name}"].new { node.value[:text] }.send(:precompiled, {}).first
27
+ [:dynamic, src]
28
+ end
29
+
24
30
  def compile_with_tilt(node, name, indent_width: 0)
25
31
  if ::Haml::Util.contains_interpolation?(node.value[:text])
26
32
  dynamic_compile(node, name, indent_width: indent_width)
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.0.9'
3
+ VERSION = '6.0.11'
4
4
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ module Haml
3
+ class Whitespace < Temple::Filter
4
+ def on_whitespace
5
+ [:static, "\n"]
6
+ end
7
+ end
8
+ end
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.0.9
4
+ version: 6.0.11
5
5
  platform: java
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: 2022-11-08 00:00:00.000000000 Z
15
+ date: 2022-11-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
@@ -333,6 +333,7 @@ files:
333
333
  - lib/haml/temple_line_counter.rb
334
334
  - lib/haml/util.rb
335
335
  - lib/haml/version.rb
336
+ - lib/haml/whitespace.rb
336
337
  homepage: https://haml.info
337
338
  licenses:
338
339
  - MIT
@@ -352,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
353
  - !ruby/object:Gem::Version
353
354
  version: '0'
354
355
  requirements: []
355
- rubygems_version: 3.2.29
356
+ rubygems_version: 3.2.33
356
357
  signing_key:
357
358
  specification_version: 4
358
359
  summary: An elegant, structured (X)HTML/XML templating engine.