about summary refs log tree commit diff
path: root/nixos/lib/make-options-doc
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2023-01-18 02:00:53 +0100
committerpennae <82953136+pennae@users.noreply.github.com>2023-01-22 17:50:09 +0100
commit2bd8129a4776f560516ad3e57825b5ca56d24e71 (patch)
treed5639a8b16f6ee4adc004a5851c7d63102835e47 /nixos/lib/make-options-doc
parentd1aa187c0e1fa3a91d1204b810794cc0f1d17842 (diff)
nixos/make-options-doc: make whitespace more md-compatible
markdown-it-py creates different whitespace leaders/trailers than are
currently emitted, and when we convert examples and defaults to render
via markdown the spacing will change too. this has no effect on rendered
output.
Diffstat (limited to 'nixos/lib/make-options-doc')
-rw-r--r--nixos/lib/make-options-doc/mergeJSON.py2
-rw-r--r--nixos/lib/make-options-doc/options-to-docbook.xsl9
2 files changed, 7 insertions, 4 deletions
diff --git a/nixos/lib/make-options-doc/mergeJSON.py b/nixos/lib/make-options-doc/mergeJSON.py
index db14808e84e70..1f30e4315cf86 100644
--- a/nixos/lib/make-options-doc/mergeJSON.py
+++ b/nixos/lib/make-options-doc/mergeJSON.py
@@ -73,7 +73,7 @@ class Renderer(mistune.renderers.BaseRenderer):
         return f"<literal>{escape(text)}</literal>"
     def block_code(self, text, info=None):
         info = f" language={quoteattr(info)}" if info is not None else ""
-        return f"<programlisting{info}>\n{escape(text)}</programlisting>"
+        return f"<programlisting{info}>{escape(text)}</programlisting>"
     def link(self, link, text=None, title=None):
         tag = "link"
         if link[0:1] == '#':
diff --git a/nixos/lib/make-options-doc/options-to-docbook.xsl b/nixos/lib/make-options-doc/options-to-docbook.xsl
index ac49659c681f8..39d34fb8633c4 100644
--- a/nixos/lib/make-options-doc/options-to-docbook.xsl
+++ b/nixos/lib/make-options-doc/options-to-docbook.xsl
@@ -75,7 +75,8 @@
               <xsl:if test="attr[@name = 'default']">
                 <para>
                   <emphasis>Default:</emphasis>
-                  <xsl:text> </xsl:text>
+                  <xsl:text>
+</xsl:text>
                   <xsl:apply-templates select="attr[@name = 'default']/*" mode="top" />
                 </para>
               </xsl:if>
@@ -83,7 +84,8 @@
               <xsl:if test="attr[@name = 'example']">
                 <para>
                   <emphasis>Example:</emphasis>
-                  <xsl:text> </xsl:text>
+                  <xsl:text>
+</xsl:text>
                   <xsl:apply-templates select="attr[@name = 'example']/*" mode="top" />
                 </para>
               </xsl:if>
@@ -124,7 +126,8 @@
   <xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExpression']]]" mode = "top">
     <xsl:choose>
       <xsl:when test="contains(attr[@name = 'text']/string/@value, '&#010;')">
-        <programlisting><xsl:value-of select="attr[@name = 'text']/string/@value" /></programlisting>
+        <programlisting><xsl:value-of select="attr[@name = 'text']/string/@value" /><xsl:text>
+</xsl:text></programlisting>
       </xsl:when>
       <xsl:otherwise>
         <literal><xsl:value-of select="attr[@name = 'text']/string/@value" /></literal>