about summary refs log tree commit diff
path: root/nixos/doc/manual/options-to-docbook.xsl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-23 19:32:19 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-23 20:08:22 +0200
commit0def73f39074f7a0699b8362a313e16abf291b31 (patch)
treef6032cef61e0b8e65410cdec81bf79b9b7ee3186 /nixos/doc/manual/options-to-docbook.xsl
parentcaf18545a495d1fd3021522211c598abfa5e500d (diff)
downloadnixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar.gz
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar.bz2
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar.lz
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar.xz
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.tar.zst
nixlib-0def73f39074f7a0699b8362a313e16abf291b31.zip
Manual: Don't depend on the absolute path of modules
This ensures that the manual has the same store path regardless of the
directory in which Nixpkgs is stored, and thus can be fetched from the
channel.
Diffstat (limited to 'nixos/doc/manual/options-to-docbook.xsl')
-rw-r--r--nixos/doc/manual/options-to-docbook.xsl15
1 files changed, 11 insertions, 4 deletions
diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl
index adc6c93c7223..c799eecc0c10 100644
--- a/nixos/doc/manual/options-to-docbook.xsl
+++ b/nixos/doc/manual/options-to-docbook.xsl
@@ -155,8 +155,15 @@
           repository (if it’s a module and we have a revision number),
           or to the local filesystem. -->
           <xsl:choose>
-            <xsl:when test="$revision != 'local' and contains(@value, '/modules/')">
-              <xsl:attribute name="xlink:href">https://github.com/NixOS/nixos/blob/<xsl:value-of select="$revision"/>/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/></xsl:attribute>
+            <xsl:when test="not(starts-with(@value, '/'))">
+              <xsl:choose>
+                <xsl:when test="$revision = 'local'">
+                  <xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/master/<xsl:value-of select="@value"/></xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/></xsl:attribute>
+                </xsl:otherwise>
+              </xsl:choose>
             </xsl:when>
             <xsl:when test="$revision != 'local' and contains(@value, 'nixops') and contains(@value, '/nix/')">
               <xsl:attribute name="xlink:href">https://github.com/NixOS/nixops/blob/<xsl:value-of select="$revision"/>/nix/<xsl:value-of select="substring-after(@value, '/nix/')"/></xsl:attribute>
@@ -169,8 +176,8 @@
           /nix/store/<hash> prefix by the default location of nixos
           sources. -->
           <xsl:choose>
-            <xsl:when test="contains(@value, '/modules/')">
-              &lt;nixos/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/>&gt;
+            <xsl:when test="not(starts-with(@value, '/'))">
+              &lt;nixpkgs/<xsl:value-of select="@value"/>&gt;
             </xsl:when>
             <xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')">
               &lt;nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>&gt;