Fix hangups in imageboard parser

Fix some hangups in the imageboard parser by allowing multiple
markup characters in a row to immediately close the markup
segment instead of going forward to try to find a non-markup
segment to include.
This commit is contained in:
Robin Malley 2021-03-20 06:39:46 +00:00
parent 55923a9cd6
commit 53b1a19c05
1 changed files with 3 additions and 2 deletions

View File

@ -60,8 +60,9 @@ local function wrap(seq,format,V"sup")
end
end
]]
local function wrap(seq,format,s)
return P(seq) * Cs((((V"marked" - s) + word + P"\n"))^1) * P(seq) / function(a)
return P(seq) * Cs((((V"marked" - s) + word + P"\n"))^0) * P(seq) / function(a)
return string.format(format,a)
end
end
@ -71,7 +72,7 @@ end
local function tag(name,format)
local start_tag = P(string.format("[%s]",name))
local end_tag = P(string.format("[/%s]",name))
return start_tag * Cs(((1 - end_tag))^1) * end_tag / function(a)
return start_tag * Cs(((1 - end_tag))^0) * end_tag / function(a)
return string.format(format,sanitize(a))
end
end