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.
This commit is contained in:
pennae 2023-01-18 02:00:53 +01:00 committed by pennae
parent d1aa187c0e
commit 2bd8129a47
2 changed files with 7 additions and 4 deletions

View file

@ -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] == '#':

View file

@ -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>