]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Accept rst syntax in .. statement:: short: text
authorPetr Špaček <pspacek@isc.org>
Mon, 27 Jun 2022 15:03:47 +0000 (17:03 +0200)
committerPetr Špaček <pspacek@isc.org>
Thu, 30 Jun 2022 16:04:44 +0000 (18:04 +0200)
Nested rst syntax is now parsed and rendered. E.g.:

.. namedconf:statement:: example
   :short: Use ``this`` **cool** syntax!

doc/arm/_ext/iscconf.py

index 122673839d0b2d25866505e0e26d2df9798f9e94..670dca4998d59c838bf0c0e45937246ba3300e50 100644 (file)
@@ -114,10 +114,18 @@ def domain_factory(domainname, domainlabel, todolist):
             def isc_short(self):
                 return self.options.get("short", "")
 
+            def parse_nested_str(self, instr):
+                """Parse string as nested rst syntax and produce a node"""
+                raw = nodes.paragraph(text=instr)
+                parsed = nodes.paragraph()
+                self.state.nested_parse(raw, self.content_offset, parsed)
+                return parsed
+
             def transform_content(self, contentnode: addnodes.desc_content) -> None:
                 """autogenerate content from structured data"""
                 if self.isc_short:
-                    contentnode.insert(0, nodes.paragraph(text=self.isc_short))
+                    short_parsed = self.parse_nested_str(self.isc_short)
+                    contentnode.insert(0, short_parsed)
                 if self.isc_tags:
                     tags = nodes.paragraph()
                     tags += nodes.strong(text="Tags: ")