From 32c3793e62f1e30187406a97e887a74705e3b313 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Fri, 18 Sep 2009 15:10:37 +0000 Subject: [PATCH] Add "defined by" and "declared by" for each option. These are list of files which link to either the remote source or the local file location. svn path=/nixos/trunk/; revision=17255 --- doc/manual/default.nix | 34 ++++++++++++++++++++++++++----- doc/manual/options-to-docbook.xsl | 9 +++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/doc/manual/default.nix b/doc/manual/default.nix index d2b92143630b..1bd6f6c0441d 100644 --- a/doc/manual/default.nix +++ b/doc/manual/default.nix @@ -10,13 +10,32 @@ let options // { system = removeAttrs options.system ["path"]; }; - optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext + optionsXML_ = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML (pkgs.lib.optionAttrSetToDocList "" options_))); - optionsDocBook = pkgs.runCommand "options-db.xml" {} '' - ${pkgs.libxslt}/bin/xsltproc -o $out ${./options-to-docbook.xsl} ${optionsXML} + optionsXML = pkgs.runCommand "options2.xml" {} '' + sed ' + \,, { + n # fetch the next line + : rewriteLinks + n # fetch the next line + \,, b # leave if this is the end of the list + ${if revision == "local" then "" else '' + # redirect nixos internals to the repository + s,,, #" + t rewriteLinks # jump to rewriteLinks if done + ''} + # redirect local file to their locations + s,,, #" + b rewriteLinks # jump to rewriteLinks + } + ' ${optionsXML_} > $out ''; - + + optionsDocBook = pkgs.runCommand "options-db.xml" {} '' + ${pkgs.libxslt}/bin/xsltproc -o $out ${./options-to-docbook.xsl} ${optionsXML} + ''; + manual = pkgs.stdenv.mkDerivation { name = "nixos-manual"; @@ -42,9 +61,14 @@ let dst=$out/share/doc/nixos ensureDir $dst xsltproc $xsltFlags --nonet --xinclude \ - --output $dst/manual.html \ + --output ./manual.html \ ${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \ ./manual.xml + + sed ' + s,!\([^!]*\)!!\([^!]*\)!,\2,g + ' ./manual.html > $dst/manual.html + ln -s ${pkgs.docbook5_xsl}/xml/xsl/docbook/images $dst/ cp ${./style.css} $dst/style.css diff --git a/doc/manual/options-to-docbook.xsl b/doc/manual/options-to-docbook.xsl index b69ea9e135ae..a9d77da977df 100644 --- a/doc/manual/options-to-docbook.xsl +++ b/doc/manual/options-to-docbook.xsl @@ -136,6 +136,13 @@ - + + + + + + + +