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)
content = text.split("\n")
if content.first && content.first.strip.empty?
removed_first = true
content.shift
end
return "/* */" if content.empty?
content.map! {|l| (l.empty? ? "" : " ") + l}
content.first.gsub!(/^ /, '')
content.first.gsub!(/^ /, '') unless removed_first
content.last.gsub!(%r{ ?\*/ *$}, '')
"/*" + content.join("\n *") + " */"
end