diff options
Diffstat (limited to 'rst_parser.lua')
-rw-r--r-- | rst_parser.lua | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/rst_parser.lua b/rst_parser.lua index 99265bd..2aa4e38 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -205,17 +205,31 @@ local parser = P{ -- Literal blocks -------------------------------------------------------------------------------- + literal_block = V"unquoted_literal_block" + + V"quoted_literal_block", + +-------------------------------------------------------------------------------- +-- Quoted literal blocks +-------------------------------------------------------------------------------- + literal_block = V"literal_block_marker" - * Cs(V"literal_block_lines" - * (V"blank_line"^1 * V"literal_block_lines")^0) - * V"blank_line"^0 - / rst.literal_block, + * Cs(V"literal_block_lines" + * (V"blank_line"^1 * V"literal_block_lines")^0) + * V"blank_line"^0 + / rst.literal_block, literal_block_marker = V"double_colon" * V"eol" * V"blank_line", - literal_block_lines = V"literal_block_first" - * (V"literal_block_other" - - V"blank_line")^0, + literal_block_lines = V"unquoted_literal_block_lines" + + V"quoted_literal_block_lines", + + unquoted_literal_block_lines = V"literal_block_first" + * (V"literal_block_other" + - V"blank_line")^0, + + quoted_literal_block_lines = V"quoted_literal_block_first" + * (V"quoted_literal_block_other" + - V"blank_line")^0, literal_block_first = Cmt(V"space"^1, function (s, i, indent) warn("lbk-f", #indent, "", "", i) @@ -240,6 +254,29 @@ local parser = P{ * V"rest_of_line" * V"eol", + quoted_literal_block_first = Cmt(V"adornment_char", function (s, i, indent) + warn("lbk-f", #indent, "", "", i) + if not indent or + indent == "" then + return false + end + tracklists.currentindent = indent + return true + end) + * V"rest_of_line" + * V"eol", + + quoted_literal_block_other = Cmt(V"adornment_char", function (s, i, indent) + warn("lbk-m", + #indent, + #tracklists.currentindent, + #indent >= #tracklists.currentindent, + i) + return #indent >= #tracklists.currentindent + end) + * V"rest_of_line" + * V"eol", + -------------------------------------------------------------------------------- -- Lists -------------------------------------------------------------------------------- |