Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Inline the list check before indented code
Diffstat (limited to '')
| -rw-r--r-- | custom/extensions/about-render.lua | 8 |
1 file changed, 2 insertions, 6 deletions
diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua index 5889e97..22be8e1 100644 --- a/custom/extensions/about-render.lua +++ b/custom/extensions/about-render.lua @@ -488,11 +488,6 @@ if has_lpeg then local function ordered(mark) return mark:match("%d") ~= nil end - local function follows_list(blocks) - local last = blocks[#blocks] - return last ~= nil and last.kind == "list" - end - -- An indented block runs on through blank lines, and up to four spaces -- or one tab come off each of its lines. local function continues_code(line) @@ -639,7 +634,8 @@ if has_lpeg then -- Four spaces or a tab start a code block, except straight -- after a list, where an indented paragraph more likely -- carries an item on. - elseif code_indent:match(line) and not follows_list(blocks) then + elseif code_indent:match(line) + and (blocks[#blocks] or {}).kind ~= "list" then local code = {} while i <= n and continues_code(lines[i]) do code[#code + 1] = unindent(lines[i]) |
