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