haml 6.0.11-java → 6.0.12-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/haml/compiler/children_compiler.rb +37 -3
- data/lib/haml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb8a21f15b84d6db83c10d326bd3016dbed2c304d6d3368ff8aa6d301ed1b552
|
4
|
+
data.tar.gz: 0b433e1f195f04713a6c18f8a61351ce47cb570f58278428fcbbd4db12fd5e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9baad8b912705b985dae60151085c8d33a7771f7fac1e8bb9ba2a9476f213f1b1b123c5df23cc6663ac8a29605090c5471b6b59b98235d8c3cd548af4f270b
|
7
|
+
data.tar.gz: f37d30f29c49e6b8aa137c9727637956c1c68f17ab4e59795a0f9fb8999f8616052c5cba4dfee6680f4b459051f0b5a0a3fe10b98996e210d06c6da635007563
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 6.0.12
|
4
|
+
|
5
|
+
* Fix a whitespace removal with `>` and an `if`-`else` statement [#1114](https://github.com/haml/haml/issues/1114)
|
6
|
+
|
3
7
|
## 6.0.11
|
4
8
|
|
5
9
|
* Fix a whitespace removal with `>` and an `if` statement [#1114](https://github.com/haml/haml/issues/1114)
|
@@ -6,6 +6,7 @@ module Haml
|
|
6
6
|
class ChildrenCompiler
|
7
7
|
def initialize
|
8
8
|
@lineno = 1
|
9
|
+
@multi_flattener = Temple::Filters::MultiFlattener.new
|
9
10
|
end
|
10
11
|
|
11
12
|
def compile(node, &block)
|
@@ -89,15 +90,48 @@ module Haml
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def rstrip_whitespace!(temple)
|
93
|
+
return if temple.size == 1
|
94
|
+
|
92
95
|
case temple[0]
|
93
|
-
when :multi
|
96
|
+
when :multi
|
94
97
|
case temple[-1][0]
|
95
|
-
when :multi, :block
|
96
|
-
rstrip_whitespace!(temple[-1])
|
97
98
|
when :whitespace
|
98
99
|
temple.delete_at(-1)
|
100
|
+
when :multi, :block
|
101
|
+
rstrip_whitespace!(temple[-1])
|
102
|
+
end
|
103
|
+
when :block
|
104
|
+
_block, code, exp = temple
|
105
|
+
if code.start_with?(/\s*if\s/)
|
106
|
+
# Remove [:whitespace] before `end`
|
107
|
+
exp.replace(@multi_flattener.call(exp))
|
108
|
+
rstrip_whitespace!(exp)
|
109
|
+
|
110
|
+
# Remove [:whitespace] before `else` if exists
|
111
|
+
else_index = find_else_index(exp)
|
112
|
+
if else_index
|
113
|
+
whitespace_index = else_index - 1
|
114
|
+
while exp[whitespace_index] == [:newline]
|
115
|
+
whitespace_index -= 1
|
116
|
+
end
|
117
|
+
if exp[whitespace_index] == [:whitespace]
|
118
|
+
exp.delete_at(whitespace_index)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def find_else_index(temple)
|
126
|
+
multi, *args = temple
|
127
|
+
return nil if multi != :multi
|
128
|
+
|
129
|
+
args.each_with_index do |arg, index|
|
130
|
+
if arg[0] == :code && arg[1].match?(/\A\s*else\s*\z/)
|
131
|
+
return index + 1
|
99
132
|
end
|
100
133
|
end
|
134
|
+
nil
|
101
135
|
end
|
102
136
|
|
103
137
|
def insert_whitespace?(node)
|
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.0.
|
4
|
+
version: 6.0.12
|
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-
|
15
|
+
date: 2022-11-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|