summary refs log tree commit diff stats
path: root/lib/packages/docutils/rstast.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/packages/docutils/rstast.nim')
-rw-r--r--lib/packages/docutils/rstast.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/packages/docutils/rstast.nim b/lib/packages/docutils/rstast.nim
index 6ba12c9be..41dadd035 100644
--- a/lib/packages/docutils/rstast.nim
+++ b/lib/packages/docutils/rstast.nim
@@ -41,8 +41,10 @@ type
     rnTable, rnGridTable, rnMarkdownTable, rnTableRow, rnTableHeaderCell, rnTableDataCell,
     rnLabel,                  # used for footnotes and other things
     rnFootnote,               # a footnote
-    rnCitation,               # similar to footnote
-    rnStandaloneHyperlink, rnHyperlink, rnRef, rnInternalRef,
+    rnCitation,               # similar to footnote, so use rnFootnote instead
+    rnFootnoteGroup,          # footnote group - exists for a purely stylistic
+                              # reason: to display a few footnotes as 1 block
+    rnStandaloneHyperlink, rnHyperlink, rnRef, rnInternalRef, rnFootnoteRef,
     rnDirective,              # a general directive
     rnDirArg,                 # a directive argument (for some directives).
                               # here are directives that are not rnDirective:
@@ -78,6 +80,8 @@ type
                               ## the document or the section; and rnEnumList
                               ## and rnAdmonition; and rnLineBlockItem
     level*: int               ## valid for headlines/overlines only
+    order*: int               ## footnote order (for auto-symbol footnotes and
+                              ## auto-numbered ones without a label)
     anchor*: string           ## anchor, internal link target
                               ## (aka HTML id tag, aka Latex label/hypertarget)
     sons*: RstNodeSeq        ## the node's sons
@@ -329,7 +333,7 @@ proc renderRstToJson*(node: PRstNode): string =
 proc renderRstToStr*(node: PRstNode, indent=0): string =
   ## Writes the parsed RST `node` into a compact string
   ## representation in the format (one line per every sub-node):
-  ## ``indent - kind - text - level (if non-zero)``
+  ## ``indent - kind - text - level - order - anchor (if non-zero)``
   ## (suitable for debugging of RST parsing).
   if node == nil:
     result.add " ".repeat(indent) & "[nil]\n"
@@ -337,6 +341,7 @@ proc renderRstToStr*(node: PRstNode, indent=0): string =
   result.add " ".repeat(indent) & $node.kind &
       (if node.text == "":   "" else: "\t'" & node.text & "'") &
       (if node.level == 0:   "" else: "\tlevel=" & $node.level) &
+      (if node.order == 0:   "" else: "\torder=" & $node.order) &
       (if node.anchor == "": "" else: "\tanchor='" & node.anchor & "'") & "\n"
   for son in node.sons:
     result.add renderRstToStr(son, indent=indent+2)