diff options
-rw-r--r-- | rst_parser.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/rst_parser.lua b/rst_parser.lua index f0e2709..5cf974c 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -970,11 +970,10 @@ local parser = P{ section_adorn = V"adornment_char"^1, - section = V"section_before"^-1 - * V"section_text" - * V"section_after" - * (V"end_block" + V"blank_line") + section = ((V"section_text" * V"section_once") + + (V"section_before" * V"section_text" * V"section_after")) / rst.section + * (V"end_block" + V"blank_line") , -- The whitespace handling after the overline is necessary because headings @@ -1007,6 +1006,16 @@ local parser = P{ * V"whitespace"^0 , + section_once = C(Cmt(V"section_adorn", function(s,i, adorn) + local tests = false + tests = state.valid_adornment:match(adorn) and true + warn ("sec-o", tests, adorn:sub(1,2) .. "…", "", i) + state.previousadorn = nil + return tests + end)) + * V"whitespace"^0 + , + -------------------------------------------------------------------------------- -- Target Blocks -------------------------------------------------------------------------------- |