Strip code indents (two spaces or one tab) if present.

This commit is contained in:
Tom Preston-Werner
2010-07-29 21:45:17 -04:00
parent 076194a34d
commit f23d093d6f
2 changed files with 20 additions and 1 deletions
+4 -1
View File
@@ -321,7 +321,10 @@ module Gollum
@codemap.each do |id, spec|
lang = spec[:lang]
code = spec[:code]
data.sub!(id, Gollum::Albino.new(code, lang).colorize)
if code.all? { |line| line =~ /^( |\t)/ }
code.gsub!(/^( |\t)/m, '')
end
data.gsub!(id, Gollum::Albino.new(code, lang).colorize)
end
data
end