make-options-doc: Support Nix-provided declaration links

Previously, the location logic was hardcoded, supporting only
Nixpkgs and NixOps properly, leaving other uses of the module
system without good location support.

Changed files
+17
nixos
lib
make-options-doc
+17
nixos/lib/make-options-doc/options-to-docbook.xsl
···
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']">
<simplelist>
<xsl:for-each select="list/string">
<member><filename>
<!-- Hyperlink the filename either to the NixOS Subversion
···
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']">
<simplelist>
+
<!--
+
Example:
+
opt.declarations = [ { name = "foo/bar.nix"; url = "https://github.com/....."; } ];
+
-->
+
<xsl:for-each select="list/attrs[attr[@name = 'name']]">
+
<member><filename>
+
<xsl:if test="attr[@name = 'url']">
+
<xsl:attribute name="xlink:href"><xsl:value-of select="attr[@name = 'url']/string/@value"/></xsl:attribute>
+
</xsl:if>
+
<xsl:value-of select="attr[@name = 'name']/string/@value"/>
+
</filename></member>
+
</xsl:for-each>
+
+
<!--
+
When the declarations/definitions are raw strings,
+
fall back to hardcoded location logic, specific to Nixpkgs.
+
-->
<xsl:for-each select="list/string">
<member><filename>
<!-- Hyperlink the filename either to the NixOS Subversion