aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sem-md/sem-md.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/sem-md/sem-md.lua b/sem-md/sem-md.lua
index 7388388..09bb66d 100644
--- a/sem-md/sem-md.lua
+++ b/sem-md/sem-md.lua
@@ -520,6 +520,9 @@ local function Statements (block)
if chars_enclosed:len() > 0 then
elems_enclosed:insert(pandoc.Str(chars_enclosed))
end
+ local str_inside = str:sub(pos, nextpos)
+ pos = nextpos + 1
+ local str_remains = str:sub(pos)
-- qualify completed bracketed enclosure
if not TableEmpty(elems_enclosed) then
@@ -534,10 +537,10 @@ local function Statements (block)
-- postpone braced-only enclosure maybe at end of block
else
- chars_unenclosed = chars_unenclosed .. str:sub(pos, nextpos)
+ chars_unenclosed = chars_unenclosed .. str_inside
elems_unenclosed:insert(pandoc.Str(chars_unenclosed))
- chars_unenclosed = str:sub(nextpos + 1)
- chars_enclosed = str:sub(nextpos + 1)
+ chars_unenclosed = str_remains
+ chars_enclosed = str_remains
encl = Enclosure.BRACED_DONE
goto continue
@@ -546,7 +549,7 @@ local function Statements (block)
elems_enclosed = pandoc.List()
elems_unenclosed = pandoc.List()
chars_enclosed = ""
- chars_unenclosed = str:sub(nextpos + 1)
+ chars_unenclosed = str_remains
encl = Enclosure.BRACED_DONE
block_has_diverged = true