From 53b1a19c05256abddcfe8ae64dbbba6706a0423a Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Sat, 20 Mar 2021 06:39:46 +0000 Subject: [PATCH] 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. --- src/lua/parser_imageboard.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lua/parser_imageboard.lua b/src/lua/parser_imageboard.lua index 2ecff09..791bffa 100644 --- a/src/lua/parser_imageboard.lua +++ b/src/lua/parser_imageboard.lua @@ -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