leading tabs in code are now replaced with two spaces!

This commit is contained in:
jdp 2010-03-16 22:58:29 -04:00
parent 37aeba2247
commit 3b48e38cba

View File

@ -136,7 +136,10 @@ class Rocco
docs_blocks, code_blocks = [], [] docs_blocks, code_blocks = [], []
sections.each do |docs,code| sections.each do |docs,code|
docs_blocks << docs.map { |line| line.sub(@comment_pattern, '') }.join("\n") docs_blocks << docs.map { |line| line.sub(@comment_pattern, '') }.join("\n")
code_blocks << code.join("\n") code_blocks << code.map do |line|
tabs = line.match(/^(\t+)/)
tabs ? line.sub(/^\t+/, ' ' * tabs.captures[0].length) : line
end.join("\n")
end end
[docs_blocks, code_blocks] [docs_blocks, code_blocks]
end end