diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-05-10 17:37:28 +0200 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-05-10 17:37:28 +0200 |
| commit | 2ee7c5d7466d8045bfa6e4f2ffa4c094d792e99b (patch) | |
| tree | a3b98e9a4f05b96704e4a508ec334bcecbfc2d48 | |
| parent | b025ef2d56fbb60cb920ef9233e3f76f38b793ce (diff) | |
rename variable enclosure -> encl
| -rw-r--r-- | _extensions/ruc-play/semantic-markdown/semantic-markdown.lua | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua index 9f4d7fc..8e93ae3 100644 --- a/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua +++ b/_extensions/ruc-play/semantic-markdown/semantic-markdown.lua @@ -223,7 +223,7 @@ local function Statements (block) -- flags for enclosing stages -- TODO: support nested bracket enclosure - local enclosure = Enclosure.NONE + local encl = Enclosure.NONE -- amount of detected statements in this block local statement_count = 0 @@ -238,19 +238,19 @@ local function Statements (block) if el.t ~= 'Str' then -- specific elements represent content enclosure - if enclosure == Enclosure.NONE then + if encl == Enclosure.NONE then if ElementTypeIsEnclosure[el.t] then - enclosure = Enclosure.BRACKETED_DONE + encl = Enclosure.BRACKETED_DONE end -- disqualify bracketing not directly followed by brace - elseif enclosure == Enclosure.BRACKETED_DONE then - enclosure = Enclosure.NONE + elseif encl == Enclosure.BRACKETED_DONE then + encl = Enclosure.NONE end -- collect element, except in braced enclosure -- TODO: support mixed-use braced enclosure - if enclosure ~= Enclosure.BRACED then + if encl ~= Enclosure.BRACED then table.insert(stack, el) end @@ -259,7 +259,7 @@ local function Statements (block) -- unenclosed -- TODO: accept backslash except immediately before bracket - if enclosure == Enclosure.NONE then + if encl == Enclosure.NONE then local _, x, s = el.text:find("^([^%[\\]*)") pos = x and x + 1 or pos + 1 if el.text:sub(pos, pos) == "[" then @@ -267,7 +267,7 @@ local function Statements (block) -- entering bracketed enclosure pos = pos + 1 stack_next = stack_next..s - enclosure = Enclosure.BRACKETED + encl = Enclosure.BRACKETED -- staying unenclosed else @@ -278,7 +278,7 @@ local function Statements (block) -- in bracketed enclosure -- TODO: accept backslash except immediately before bracket/brace -- TODO: support nested bracket enclosure - if enclosure == Enclosure.BRACKETED then + if encl == Enclosure.BRACKETED then local _, x, s = el.text:find("^([^%[%]}\\]*)", pos) pos = x and x + 1 or pos + 1 stack_next = stack_next..s @@ -286,21 +286,21 @@ local function Statements (block) -- exiting bracketed enclosure if el.text:sub(pos, pos) == "]" then pos = pos + 1 - enclosure = Enclosure.BRACKETED_DONE + encl = Enclosure.BRACKETED_DONE end end -- exited bracketed enclosure - if enclosure == Enclosure.BRACKETED_DONE then + if encl == Enclosure.BRACKETED_DONE then -- entering braced enclosure if el.text:sub(pos, pos) == "{" then pos = pos + 1 - enclosure = Enclosure.BRACED + encl = Enclosure.BRACED -- leaving non-annotation enclosure else - enclosure = Enclosure.NONE + encl = Enclosure.NONE -- TODO: parse remains of Str end @@ -308,7 +308,7 @@ local function Statements (block) -- in braced enclosure, leaving it -- TODO: support mixed-use enclosure - if enclosure == Enclosure.BRACED then + if encl == Enclosure.BRACED then local _, d1 = el.text:find("^"..curie_long.."}", pos) local _, d2 = el.text:find("^"..curie_no_ref.."}", pos) local _, d3 = el.text:find("^"..curie_local.."}", pos) @@ -321,7 +321,7 @@ local function Statements (block) -- TODO: instead recursively call Statements() on remains of Str stack_next = stack_next..el.text:sub(pos) - enclosure = Enclosure.NONE + encl = Enclosure.NONE end end |
