summary refs log tree commit diff stats
path: root/lib/packages
diff options
context:
space:
mode:
authorAndrey Makarov <ph.makarov@gmail.com>2021-10-06 14:53:01 +0300
committerGitHub <noreply@github.com>2021-10-06 13:53:01 +0200
commitf03872d99ec2d25de829415a75162f9d8297bb19 (patch)
tree9ead3ff455071b3d868fcbd0800548beb562855c /lib/packages
parentb2873f0f63f7741ee995363a6bb225a228d03d18 (diff)
downloadNim-f03872d99ec2d25de829415a75162f9d8297bb19.tar.gz
rst: minor fixes (#18960)
Diffstat (limited to 'lib/packages')
-rw-r--r--lib/packages/docutils/rst.nim1
-rw-r--r--lib/packages/docutils/rstast.nim4
-rw-r--r--lib/packages/docutils/rstgen.nim2
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim
index abea026dd..29234f28b 100644
--- a/lib/packages/docutils/rst.nim
+++ b/lib/packages/docutils/rst.nim
@@ -172,6 +172,7 @@
 ##     ``header``, ``footer``, ``meta``, ``class``
 ##     - no ``role`` directives and no custom interpreted text roles
 ##     - some standard roles are not supported (check `RST roles list`_)
+##     - no generic admonition support
 ## * inline markup
 ##   - no simple-inline-markup
 ##   - no embedded aliases
diff --git a/lib/packages/docutils/rstast.nim b/lib/packages/docutils/rstast.nim
index fa0620f44..e1ed7c099 100644
--- a/lib/packages/docutils/rstast.nim
+++ b/lib/packages/docutils/rstast.nim
@@ -381,7 +381,7 @@ proc renderRstToText*(node: PRstNode): string =
       result.add renderRstToText(node.sons[i])
     if node.kind in code: result.add "`"
 
-proc renderRstToStr*(node: PRstNode, indent=0): string =
+proc treeRepr*(node: PRstNode, indent=0): string =
   ## Writes the parsed RST `node` into an AST tree with compact string
   ## representation in the format (one line per every sub-node):
   ## ``indent - kind - [text|level|order|adType] - anchor (if non-zero)``
@@ -411,4 +411,4 @@ proc renderRstToStr*(node: PRstNode, indent=0): string =
   result.add (if node.anchor == "": "" else: "  anchor='" & node.anchor & "'")
   result.add "\n"
   for son in node.sons:
-    result.add renderRstToStr(son, indent=indent+2)
+    result.add treeRepr(son, indent=indent+2)
diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim
index 7d7eb4fb8..8eac37307 100644
--- a/lib/packages/docutils/rstgen.nim
+++ b/lib/packages/docutils/rstgen.nim
@@ -1164,7 +1164,7 @@ proc renderAdmonition(d: PDoc, n: PRstNode, result: var string) =
   case n.adType
   of "hint", "note", "tip":
     htmlCls = "admonition-info"; texSz = "\\normalsize"; texColor = "green"
-  of "attention", "admonition", "important", "warning":
+  of "attention", "admonition", "important", "warning", "caution":
     htmlCls = "admonition-warning"; texSz = "\\large"; texColor = "orange"
   of "danger", "error":
     htmlCls = "admonition-error"; texSz = "\\Large"; texColor = "red"