stupid Ruby 1.8.7 doesn't support named groups
This commit is contained in:
parent
53dec6a4f6
commit
0fa03d2651
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue