stupid Ruby 1.8.7 doesn't support named groups

This commit is contained in:
maul.esel 2013-06-13 18:48:40 +02:00
parent 53dec6a4f6
commit 0fa03d2651
1 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ module Jekyll
end
end
MATCHER = /(?<param>\w+)=(?:"(?<dvar>[^"\\]*(?:\\.[^"\\]*)*)"|'(?<svar>[^'\\]*(?:\\.[^'\\]*)*)')/
MATCHER = /(\w+)=(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)')/
def parse_params(markup)
@params = {}
@ -37,13 +37,13 @@ eos
while match = MATCHER.match(markup, pos) do
pos = match.end(0)
if match[:dvar]
value = match[:dvar].gsub(/\\"/, '"')
elsif match[:svar]
value = match[:svar].gsub(/\\'/, "'")
if match[2]
value = match[2].gsub(/\\"/, '"')
elsif match[3]
value = match[3].gsub(/\\'/, "'")
end
@params[match[:param]] = value
@params[match[1]] = value
end
end