Permalink
Browse files

Add a space at the ends of HTML multi-lines

  • Loading branch information...
1 parent d6fca0d commit 09fe16658e13e36e9ec80900657887808e993533 @mxcl committed Mar 14, 2013
Showing with 12 additions and 12 deletions.
  1. +7 −7 README.md
  2. +1 −1 bsc
  3. +4 −4 tests
View
@@ -134,22 +134,22 @@ We have not done that yet though. Please fork and fix! Or suggest better
solutions in a ticket! :)
-HTML Blocks Whitespace
-======================
-Typically we don't add whitespace around stuff eg:
+HTML Blocks & Whitespace
+========================
+We add a space at the ends of HTML lines:
<b>Boo
Foo
Goo</b>
Will compile to:
- '<b>Boo'+
- 'Foo'+
+ '<b>Boo '+
+ 'Foo '+
Goo'</b>'
-Which renders as 'BooFooGoo', when 'Boo Foo Goo' was probably expected. We
-should fix the compiler to add newlines (or spaces) into the strings.
+We do this because if you wrote that HTML the newline would count as
+whitespace. We use a space instead of a newline as it’s less visual-noise.
Caveats
View
2 bsc
@@ -136,7 +136,7 @@ tokenize do |type, string, opts|
end
end.join
- string.chop!.gsub!(/\s*\n(\s*)/m, %Q{'+\n\\1'}) if comma_terminated
+ string.chop!.gsub!(/\s*\n(\s*)/m, %Q{ '+\n\\1'}) if comma_terminated
string = "'#{string}'"
string = "$(#{string})" if opts[:jQuerize]
string = "#{string};" if comma_terminated
View
8 tests
@@ -78,10 +78,10 @@ class BullTests < Test::Unit::TestCase
</ol>;
end
output = <<-end
- var a = $('<ol>'+
- '<li>one'+
- '<li>two'+
- '<li>three'+
+ var a = $('<ol> '+
+ '<li>one '+
+ '<li>two '+
+ '<li>three '+
'</ol>');
end
assert_equal input, output

0 comments on commit 09fe166

Please sign in to comment.