make-options-doc: Make optionIdPrefix configurable ("opt-")

This commit is contained in:
Robert Hensing 2022-09-29 12:34:06 +02:00
parent f54f12a602
commit 91879ce160
2 changed files with 5 additions and 1 deletions

View file

@ -26,6 +26,8 @@
# If you include more than one option list into a document, you need to # If you include more than one option list into a document, you need to
# provide different ids. # provide different ids.
, variablelistId ? "configuration-variable-list" , variablelistId ? "configuration-variable-list"
# Strig to prefix to the option XML/HTML id attributes.
, optionIdPrefix ? "opt-"
, revision ? "" # Specify revision for the options , revision ? "" # Specify revision for the options
# a set of options the docs we are generating will be merged into, as if by recursiveUpdate. # a set of options the docs we are generating will be merged into, as if by recursiveUpdate.
# used to split the options doc build into a static part (nixos/modules) and a dynamic part # used to split the options doc build into a static part (nixos/modules) and a dynamic part
@ -183,6 +185,7 @@ in rec {
--stringparam documentType '${documentType}' \ --stringparam documentType '${documentType}' \
--stringparam revision '${revision}' \ --stringparam revision '${revision}' \
--stringparam variablelistId '${variablelistId}' \ --stringparam variablelistId '${variablelistId}' \
--stringparam optionIdPrefix '${optionIdPrefix}' \
-o intermediate.xml ${./options-to-docbook.xsl} sorted.xml -o intermediate.xml ${./options-to-docbook.xsl} sorted.xml
${pkgs.libxslt.bin}/bin/xsltproc \ ${pkgs.libxslt.bin}/bin/xsltproc \
-o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml

View file

@ -15,6 +15,7 @@
<xsl:param name="documentType" /> <xsl:param name="documentType" />
<xsl:param name="program" /> <xsl:param name="program" />
<xsl:param name="variablelistId" /> <xsl:param name="variablelistId" />
<xsl:param name="optionIdPrefix" />
<xsl:template match="/expr/list"> <xsl:template match="/expr/list">
@ -36,7 +37,7 @@
<xsl:attribute name="id" namespace="http://www.w3.org/XML/1998/namespace"><xsl:value-of select="$variablelistId"/></xsl:attribute> <xsl:attribute name="id" namespace="http://www.w3.org/XML/1998/namespace"><xsl:value-of select="$variablelistId"/></xsl:attribute>
<xsl:for-each select="attrs"> <xsl:for-each select="attrs">
<xsl:variable name="id" select=" <xsl:variable name="id" select="
concat('opt-', concat($optionIdPrefix,
translate( translate(
attr[@name = 'name']/string/@value, attr[@name = 'name']/string/@value,
'*&lt; >[]:', '*&lt; >[]:',