Module:Citation/CS1: Difference between revisions

pattern not a literal string bites again
m>Trappist the monk
(Synch from sandbox;)
m>Trappist the monk
(pattern not a literal string bites again)
Line 720: Line 720:
pattern, c1, c2 = argument:match ("(%'%'(.*)%'%'%'(.*)%'%'%'%'%')");
pattern, c1, c2 = argument:match ("(%'%'(.*)%'%'%'(.*)%'%'%'%'%')");
end
end
pattern = pattern:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1"); -- pattern is not a literal string; escape lua's magic pattern characters
argument=argument:gsub(pattern, c1..c2); -- remove the markup
argument=argument:gsub(pattern, c1..c2); -- remove the markup
else
else
Line 728: Line 729:
if argument:match ("%'%'%'.*%'%'%'") then -- is there an instance of bold?
if argument:match ("%'%'%'.*%'%'%'") then -- is there an instance of bold?
pattern, c1 = argument:match ("(%'%'%'(.*)%'%'%')")
pattern, c1 = argument:match ("(%'%'%'(.*)%'%'%')")
pattern = pattern:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1"); -- pattern is not a literal string; escape lua's magic pattern characters
argument=argument:gsub(pattern, c1); -- remove the markup
argument=argument:gsub(pattern, c1); -- remove the markup
else
else
Line 736: Line 738:
if argument:match ("%'%'.*%'%'") then -- is there an instance of italic?
if argument:match ("%'%'.*%'%'") then -- is there an instance of italic?
pattern, c1 = argument:match ("(%'%'(.*)%'%')")
pattern, c1 = argument:match ("(%'%'(.*)%'%')")
pattern = pattern:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1"); -- pattern is not a literal string; escape lua's magic pattern characters
argument=argument:gsub(pattern, c1); -- remove the markup
argument=argument:gsub(pattern, c1); -- remove the markup
else
else
Anonymous user