about summary refs log tree commit diff
path: root/release.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-11 02:13:28 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-11 02:13:28 +0100
commit01a420e428c285b2e3b59c1d8c1be54ca7cb5372 (patch)
tree90306efbce4644924c164db9cc41e63504bfb747 /release.nix
parent5d3b9bd147fbffea367af3bce4c1a40305027783 (diff)
release: Turn manual into serveral chunks.
This allows us to write separate chapters/parts of documentation without
getting one big HTML page with everything at once.

Now the chunk.xsl by default chunks of <preface/> elements, so we'd like
to control this by patching docbook5_xsl directly and prevent it from
doing that.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'release.nix')
-rw-r--r--release.nix28
1 files changed, 23 insertions, 5 deletions
diff --git a/release.nix b/release.nix
index 727b8ff8..4ecbeabc 100644
--- a/release.nix
+++ b/release.nix
@@ -94,6 +94,22 @@ in with pkgsUpstream.lib; with builtins; {
       inherit system;
     };
 
+    patchedDocbookXSL = overrideDerivation pkgsUpstream.docbook5_xsl (drv: {
+      # Don't chunk off <preface/>
+      postPatch = (drv.postPatch or "") + ''
+        sed -i -e '
+          /<xsl:when.*preface/d
+          /<xsl:for-each/s!|//d:preface \+!!g
+          /<xsl:variable/s!|[a-z]\+::d:preface\[1\] \+!!g
+        ' xhtml/chunk-common.xsl
+
+        sed -i -e '
+          /<xsl:when.*preface/,/<\/xsl:when>/d
+          /<xsl:template/s!|d:preface!!g
+        ' xhtml/chunk-code.xsl
+      '';
+    });
+
     isVuizvui = opt: head (splitString "." opt.name) == "vuizvui";
     filterDoc = filter (opt: isVuizvui opt && opt.visible && !opt.internal);
     optionsXML = toXML (filterDoc (optionAttrSetToDocList modules.options));
@@ -118,15 +134,17 @@ in with pkgsUpstream.lib; with builtins; {
         "${nixpkgs}/nixos/doc/manual/options-to-docbook.xsl" \
         ${optionsFile}
 
-      xsltproc -o "$out/manual.html" $xsltFlags -nonet -xinclude \
-        ${pkgsUpstream.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
+      dest="$out/share/doc/vuizvui"
+      mkdir -p "$dest"
+
+      xsltproc -o "$dest/" $xsltFlags -nonet -xinclude \
+        ${patchedDocbookXSL}/xml/xsl/docbook/xhtml/chunk.xsl \
         doc/index.xml
 
-      cp "${nixpkgs}/nixos/doc/manual/style.css" "$out/style.css"
+      cp "${nixpkgs}/nixos/doc/manual/style.css" "$dest/style.css"
 
       mkdir -p "$out/nix-support"
-      echo "doc manual $out manual.html" \
-        > "$out/nix-support/hydra-build-products"
+      echo "doc manual $dest" > "$out/nix-support/hydra-build-products"
     '';
   };
 }