haml-edge 2.3.248 → 2.3.249
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.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml/html.rb +13 -0
- data/test/haml/html2haml_test.rb +33 -0
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.249
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.249
|
data/lib/haml/html.rb
CHANGED
@@ -279,6 +279,18 @@ module Haml
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
+
if self.next && self.next.text? && self.next.content =~ /\A[^\s]/
|
283
|
+
if self.previous.nil? || self.previous.text? &&
|
284
|
+
(self.previous.content =~ /[^\s]\Z/ ||
|
285
|
+
self.previous.content =~ /\A\s*\Z/ && self.previous.previous.nil?)
|
286
|
+
nuke_outer_whitespace = true
|
287
|
+
else
|
288
|
+
output << "- succeed #{self.next.content.slice!(/\A[^\s]+/).dump} do\n"
|
289
|
+
tabs += 1
|
290
|
+
output << tabulate(tabs)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
282
294
|
output << "%#{name}" unless name == 'div' &&
|
283
295
|
(static_id?(options) ||
|
284
296
|
static_classname?(options) &&
|
@@ -300,6 +312,7 @@ module Haml
|
|
300
312
|
output << haml_attributes(options) if attr_hash.length > 0
|
301
313
|
end
|
302
314
|
|
315
|
+
output << ">" if nuke_outer_whitespace
|
303
316
|
output << "/" if empty? && !etag
|
304
317
|
|
305
318
|
if children && children.size == 1
|
data/test/haml/html2haml_test.rb
CHANGED
@@ -246,6 +246,39 @@ HTML
|
|
246
246
|
assert_equal("%p # foo bar #", render("<p># foo bar #</p>"))
|
247
247
|
end
|
248
248
|
|
249
|
+
def test_comma_post_tag
|
250
|
+
assert_equal(<<HAML.rstrip, render(<<HTML))
|
251
|
+
#foo
|
252
|
+
%span> Foo
|
253
|
+
,
|
254
|
+
%span bar
|
255
|
+
Foo
|
256
|
+
%span> bar
|
257
|
+
,
|
258
|
+
%span baz
|
259
|
+
HAML
|
260
|
+
<div id="foo">
|
261
|
+
<span>Foo</span>, <span>bar</span>
|
262
|
+
Foo<span>bar</span>, <span>baz</span>
|
263
|
+
</div>
|
264
|
+
HTML
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_comma_post_tag_with_text_before
|
268
|
+
assert_equal(<<HAML.rstrip, render(<<HTML))
|
269
|
+
#foo
|
270
|
+
Batch
|
271
|
+
- succeed "," do
|
272
|
+
%span Foo
|
273
|
+
%span Bar
|
274
|
+
HAML
|
275
|
+
<div id="foo">
|
276
|
+
Batch
|
277
|
+
<span>Foo</span>, <span>Bar</span>
|
278
|
+
</div>
|
279
|
+
HTML
|
280
|
+
end
|
281
|
+
|
249
282
|
begin
|
250
283
|
require 'haml/html/erb'
|
251
284
|
include ErbTests
|