Fix parsing extra whitespace in code blocks
This commit is contained in:
@@ -459,11 +459,12 @@ module Gollum
|
||||
# Returns the placeholder'd String data.
|
||||
def extract_code(data)
|
||||
data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```\r?$/m) do
|
||||
id = Digest::SHA1.hexdigest("#{$2}.#{$3}")
|
||||
lang = $2 ? $2.strip : nil
|
||||
id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
|
||||
cached = check_cache(:code, id)
|
||||
@codemap[id] = cached ?
|
||||
{ :output => cached } :
|
||||
{ :lang => $2, :code => $3, :indent => $1 }
|
||||
{ :lang => lang, :code => $3, :indent => $1 }
|
||||
"#{$1}#{id}" # print the SHA1 ID with the proper indentation
|
||||
end
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user