implement RST & Markdown quote blocks (#19147)
* implement RST & Markdown quote blocks * compile with nim 1.0 * Fix indentation
This commit is contained in:
parent
7772ca303c
commit
040d23e799
7 changed files with 617 additions and 12 deletions
|
|
@ -32,7 +32,10 @@ type
|
|||
rnFieldName, # consisting of a field name ...
|
||||
rnFieldBody, # ... and a field body
|
||||
rnOptionList, rnOptionListItem, rnOptionGroup, rnOption, rnOptionString,
|
||||
rnOptionArgument, rnDescription, rnLiteralBlock, rnQuotedLiteralBlock,
|
||||
rnOptionArgument, rnDescription, rnLiteralBlock,
|
||||
rnMarkdownBlockQuote, # a quote starting from punctuation like >>>
|
||||
rnMarkdownBlockQuoteItem, # a quotation block, quote lines starting with
|
||||
# the same number of chars
|
||||
rnLineBlock, # the | thingie
|
||||
rnLineBlockItem, # a son of rnLineBlock - one line inside it.
|
||||
# When `RstNode` lineIndent="\n" the line's empty
|
||||
|
|
@ -101,6 +104,8 @@ type
|
|||
of rnFootnote, rnCitation, rnOptionListItem:
|
||||
order*: int ## footnote order (for auto-symbol footnotes and
|
||||
## auto-numbered ones without a label)
|
||||
of rnMarkdownBlockQuoteItem:
|
||||
quotationDepth*: int ## number of characters in line prefix
|
||||
of rnRef, rnSubstitutionReferences,
|
||||
rnInterpretedText, rnField, rnInlineCode, rnCodeBlock, rnFootnoteRef:
|
||||
info*: TLineInfo ## To have line/column info for warnings at
|
||||
|
|
@ -409,6 +414,8 @@ proc treeRepr*(node: PRstNode, indent=0): string =
|
|||
result.add " level=" & $node.level
|
||||
of rnFootnote, rnCitation, rnOptionListItem:
|
||||
result.add (if node.order == 0: "" else: " order=" & $node.order)
|
||||
of rnMarkdownBlockQuoteItem:
|
||||
result.add " quotationDepth=" & $node.quotationDepth
|
||||
else:
|
||||
discard
|
||||
result.add (if node.anchor == "": "" else: " anchor='" & node.anchor & "'")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue