1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Retrofit some comment parsing and tests to fit the new comment stuff.

This commit is contained in:
Nathan Weizenbaum 2010-02-16 17:05:43 -08:00
parent 9a01a63fa0
commit ccb8081264
3 changed files with 10 additions and 4 deletions

View file

@ -524,9 +524,15 @@ WARNING
def format_comment_text(text) def format_comment_text(text)
content = text.split("\n") content = text.split("\n")
if content.first && content.first.strip.empty?
removed_first = true
content.shift
end
return "/* */" if content.empty? return "/* */" if content.empty?
content.map! {|l| (l.empty? ? "" : " ") + l} content.map! {|l| (l.empty? ? "" : " ") + l}
content.first.gsub!(/^ /, '') content.first.gsub!(/^ /, '') unless removed_first
content.last.gsub!(%r{ ?\*/ *$}, '') content.last.gsub!(%r{ ?\*/ *$}, '')
"/*" + content.join("\n *") + " */" "/*" + content.join("\n *") + " */"
end end

View file

@ -117,8 +117,8 @@ span.turkey
#overhere #overhere
bored: sorta bored: sorta
/* it's for a good /* it's for a good
cause cause
better_than: thread_pools better_than: thread_pools
#one_more #one_more

View file

@ -1077,7 +1077,7 @@ SOURCE
RESULT RESULT
.box .box
:border :border
/*:color black /* :color black
:style solid :style solid
SOURCE SOURCE