From cd6bf8aa00962766e4db9f26e36848b6be8dd096 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:23:39 -0400 Subject: docs: use a single nix-build for all the generate function docs --- doc/Makefile | 16 +++--- doc/default.nix | 6 +-- doc/doc-support/default.nix | 14 +++++ doc/doc-support/lib-function-docs.nix | 26 +++++++++ doc/doc-support/lib-function-locations.nix | 85 ++++++++++++++++++++++++++++++ doc/lib-function-docs.nix | 26 --------- doc/lib-function-locations.nix | 85 ------------------------------ 7 files changed, 134 insertions(+), 124 deletions(-) create mode 100644 doc/doc-support/default.nix create mode 100644 doc/doc-support/lib-function-docs.nix create mode 100644 doc/doc-support/lib-function-locations.nix delete mode 100644 doc/lib-function-docs.nix delete mode 100644 doc/lib-function-locations.nix diff --git a/doc/Makefile b/doc/Makefile index 5badfe4138d43..4cd493d5565c7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,7 +21,7 @@ fix-misc-xml: .PHONY: clean clean: - rm -f ${MD_TARGETS} .version manual-full.xml functions/library/locations.xml functions/library/generated + rm -f ${MD_TARGETS} doc-support/result .version manual-full.xml functions/library/locations.xml functions/library/generated rm -rf ./out/ ./highlightjs .PHONY: validate @@ -78,14 +78,14 @@ manual-full.xml: ${MD_TARGETS} .version functions/library/locations.xml function nix-instantiate --eval \ -E '(import ../lib).version' > .version -functions/library/locations.xml: - nix-build ./lib-function-locations.nix \ - --out-link $@ +doc-support/result: + (cd doc-support; nix-build) -functions/library/generated: functions/library/locations.xml - nix-build ./lib-function-docs.nix \ - --arg locationsXml $< \ - --out-link $@ +functions/library/locations.xml: doc-support/result + ln -rfs ./doc-support/result/function-locations.xml functions/library/locations.xml + +functions/library/generated: doc-support/result + ln -rfs ./doc-support/result/function-docs functions/library/generated %.section.xml: %.section.md pandoc $^ -w docbook+smart \ diff --git a/doc/default.nix b/doc/default.nix index 7ceaec28af38b..7b44376034cab 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -1,8 +1,7 @@ { pkgs ? (import ./.. { }), nixpkgs ? { }}: let lib = pkgs.lib; - locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; }; - functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; }; + doc-support = import ./doc-support { inherit pkgs nixpkgs; }; in pkgs.stdenv.mkDerivation { name = "nixpkgs-manual"; @@ -30,9 +29,6 @@ in pkgs.stdenv.mkDerivation { ]; postPatch = '' - rm -rf ./functions/library/locations.xml - ln -s ${locationsXml} ./functions/library/locations.xml - ln -s ${functionDocs} ./functions/library/generated echo ${lib.version} > .version ''; diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix new file mode 100644 index 0000000000000..93f6287d4b09c --- /dev/null +++ b/doc/doc-support/default.nix @@ -0,0 +1,14 @@ +{ pkgs ? (import ../.. {}), nixpkgs ? { }}: +let + locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; }; + functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; }; +in pkgs.runCommand "doc-support" {} +'' + mkdir result + ( + cd result + ln -s ${locationsXml} ./function-locations.xml + ln -s ${functionDocs} ./function-docs + ) + mv result $out +'' diff --git a/doc/doc-support/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix new file mode 100644 index 0000000000000..5199b949e7b86 --- /dev/null +++ b/doc/doc-support/lib-function-docs.nix @@ -0,0 +1,26 @@ +# Generates the documentation for library functons via nixdoc. To add +# another library function file to this list, the include list in the +# file `doc/functions/library.xml` must also be updated. + +{ pkgs ? import ./.. {}, locationsXml }: + +with pkgs; stdenv.mkDerivation { + name = "nixpkgs-lib-docs"; + src = ./../../lib; + + buildInputs = [ nixdoc ]; + installPhase = '' + function docgen { + nixdoc -c "$1" -d "$2" -f "../lib/$1.nix" > "$out/$1.xml" + } + + mkdir -p $out + ln -s ${locationsXml} $out/locations.xml + + docgen strings 'String manipulation functions' + docgen trivial 'Miscellaneous functions' + docgen lists 'List manipulation functions' + docgen debug 'Debugging functions' + docgen options 'NixOS / nixpkgs option handling' + ''; +} diff --git a/doc/doc-support/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix new file mode 100644 index 0000000000000..ae7036e462643 --- /dev/null +++ b/doc/doc-support/lib-function-locations.nix @@ -0,0 +1,85 @@ +{ pkgs ? (import ./.. { }), nixpkgs ? { }}: +let + revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.revision or "master"); + + libDefPos = set: + builtins.map + (name: { + name = name; + location = builtins.unsafeGetAttrPos name set; + }) + (builtins.attrNames set); + + libset = toplib: + builtins.map + (subsetname: { + subsetname = subsetname; + functions = libDefPos toplib."${subsetname}"; + }) + (builtins.filter + (name: builtins.isAttrs toplib."${name}") + (builtins.attrNames toplib)); + + nixpkgsLib = pkgs.lib; + + flattenedLibSubset = { subsetname, functions }: + builtins.map + (fn: { + name = "lib.${subsetname}.${fn.name}"; + value = fn.location; + }) + functions; + + locatedlibsets = libs: builtins.map flattenedLibSubset (libset libs); + removeFilenamePrefix = prefix: filename: + let + prefixLen = (builtins.stringLength prefix) + 1; # +1 to remove the leading / + filenameLen = builtins.stringLength filename; + substr = builtins.substring prefixLen filenameLen filename; + in substr; + + removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path); + + liblocations = + builtins.filter + (elem: elem.value != null) + (nixpkgsLib.lists.flatten + (locatedlibsets nixpkgsLib)); + + fnLocationRelative = { name, value }: + { + inherit name; + value = value // { file = removeNixpkgs value.file; }; + }; + + relativeLocs = (builtins.map fnLocationRelative liblocations); + sanitizeId = builtins.replaceStrings + [ "'" ] + [ "-prime" ]; + + urlPrefix = "https://github.com/NixOS/nixpkgs/blob/${revision}"; + xmlstrings = (nixpkgsLib.strings.concatMapStrings + ({ name, value }: + '' +
${name} + + Located at + ${value.file}:${builtins.toString value.line} + in <nixpkgs>. + +
+ '') + relativeLocs); + +in pkgs.writeText + "locations.xml" + '' +
+ All the locations for every lib function + This file is only for inclusion by other files. + ${xmlstrings} +
+ '' diff --git a/doc/lib-function-docs.nix b/doc/lib-function-docs.nix deleted file mode 100644 index 421f848d25abf..0000000000000 --- a/doc/lib-function-docs.nix +++ /dev/null @@ -1,26 +0,0 @@ -# Generates the documentation for library functons via nixdoc. To add -# another library function file to this list, the include list in the -# file `doc/functions/library.xml` must also be updated. - -{ pkgs ? import ./.. {}, locationsXml }: - -with pkgs; stdenv.mkDerivation { - name = "nixpkgs-lib-docs"; - src = ./../lib; - - buildInputs = [ nixdoc ]; - installPhase = '' - function docgen { - nixdoc -c "$1" -d "$2" -f "../lib/$1.nix" > "$out/$1.xml" - } - - mkdir -p $out - ln -s ${locationsXml} $out/locations.xml - - docgen strings 'String manipulation functions' - docgen trivial 'Miscellaneous functions' - docgen lists 'List manipulation functions' - docgen debug 'Debugging functions' - docgen options 'NixOS / nixpkgs option handling' - ''; -} diff --git a/doc/lib-function-locations.nix b/doc/lib-function-locations.nix deleted file mode 100644 index ae7036e462643..0000000000000 --- a/doc/lib-function-locations.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ pkgs ? (import ./.. { }), nixpkgs ? { }}: -let - revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.revision or "master"); - - libDefPos = set: - builtins.map - (name: { - name = name; - location = builtins.unsafeGetAttrPos name set; - }) - (builtins.attrNames set); - - libset = toplib: - builtins.map - (subsetname: { - subsetname = subsetname; - functions = libDefPos toplib."${subsetname}"; - }) - (builtins.filter - (name: builtins.isAttrs toplib."${name}") - (builtins.attrNames toplib)); - - nixpkgsLib = pkgs.lib; - - flattenedLibSubset = { subsetname, functions }: - builtins.map - (fn: { - name = "lib.${subsetname}.${fn.name}"; - value = fn.location; - }) - functions; - - locatedlibsets = libs: builtins.map flattenedLibSubset (libset libs); - removeFilenamePrefix = prefix: filename: - let - prefixLen = (builtins.stringLength prefix) + 1; # +1 to remove the leading / - filenameLen = builtins.stringLength filename; - substr = builtins.substring prefixLen filenameLen filename; - in substr; - - removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path); - - liblocations = - builtins.filter - (elem: elem.value != null) - (nixpkgsLib.lists.flatten - (locatedlibsets nixpkgsLib)); - - fnLocationRelative = { name, value }: - { - inherit name; - value = value // { file = removeNixpkgs value.file; }; - }; - - relativeLocs = (builtins.map fnLocationRelative liblocations); - sanitizeId = builtins.replaceStrings - [ "'" ] - [ "-prime" ]; - - urlPrefix = "https://github.com/NixOS/nixpkgs/blob/${revision}"; - xmlstrings = (nixpkgsLib.strings.concatMapStrings - ({ name, value }: - '' -
${name} - - Located at - ${value.file}:${builtins.toString value.line} - in <nixpkgs>. - -
- '') - relativeLocs); - -in pkgs.writeText - "locations.xml" - '' -
- All the locations for every lib function - This file is only for inclusion by other files. - ${xmlstrings} -
- '' -- cgit 1.4.1 From d11f5a9d15c2d1eb735750392d69d515ae51df6c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:27:16 -0400 Subject: docs: get version from doc-support build --- doc/Makefile | 7 +++---- doc/default.nix | 2 +- doc/doc-support/default.nix | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 4cd493d5565c7..06a70519488e0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -74,11 +74,10 @@ highlightjs: manual-full.xml: ${MD_TARGETS} .version functions/library/locations.xml functions/library/generated *.xml **/*.xml **/**/*.xml xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml -.version: - nix-instantiate --eval \ - -E '(import ../lib).version' > .version +.version: doc-support/result + ln -rfs ./doc-support/result/version .version -doc-support/result: +doc-support/result: doc-support/default.nix (cd doc-support; nix-build) functions/library/locations.xml: doc-support/result diff --git a/doc/default.nix b/doc/default.nix index 7b44376034cab..5cd91e0f11216 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -29,7 +29,7 @@ in pkgs.stdenv.mkDerivation { ]; postPatch = '' - echo ${lib.version} > .version + ln -s ${doc-support} ./doc-support/result ''; installPhase = '' diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index 93f6287d4b09c..94b3ea464d9f4 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -2,6 +2,7 @@ let locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; }; functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; }; + version = pkgs.lib.version; in pkgs.runCommand "doc-support" {} '' mkdir result @@ -9,6 +10,7 @@ in pkgs.runCommand "doc-support" {} cd result ln -s ${locationsXml} ./function-locations.xml ln -s ${functionDocs} ./function-docs + echo -n "${version}" > ./version ) mv result $out '' -- cgit 1.4.1 From e65c2c66726dfa77e3b9ab51ae85887884162c8f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:30:13 -0400 Subject: docs: find docbook rng from doc-support --- doc/Makefile | 4 ++-- doc/default.nix | 1 - doc/doc-support/default.nix | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 06a70519488e0..afd3c781ebf9b 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -25,8 +25,8 @@ clean: rm -rf ./out/ ./highlightjs .PHONY: validate -validate: manual-full.xml - jing "$$RNG" manual-full.xml +validate: manual-full.xml doc-support/result + jing doc-support/result/docbook.rng manual-full.xml out/html/index.html: manual-full.xml style.css highlightjs mkdir -p out/html diff --git a/doc/default.nix b/doc/default.nix index 5cd91e0f11216..5a606981d8c29 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -15,7 +15,6 @@ in pkgs.stdenv.mkDerivation { # otherwise they won't reapply :) HIGHLIGHTJS = pkgs.documentation-highlighter; XSL = "${pkgs.docbook_xsl_ns}/xml/xsl"; - RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng"; XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf; xsltFlags = lib.concatStringsSep " " [ "--param section.autolabel 1" diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index 94b3ea464d9f4..6cf7666ccf8d4 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -10,6 +10,9 @@ in pkgs.runCommand "doc-support" {} cd result ln -s ${locationsXml} ./function-locations.xml ln -s ${functionDocs} ./function-docs + + ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng + echo -n "${version}" > ./version ) mv result $out -- cgit 1.4.1 From 35262ba6a78125e6f76055dd99416a93d00288fb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:46:47 -0400 Subject: docs: get XSL from build / symlink --- doc/Makefile | 10 +++++----- doc/default.nix | 1 - doc/doc-support/default.nix | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index afd3c781ebf9b..c127bea13c1e0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -28,12 +28,12 @@ clean: validate: manual-full.xml doc-support/result jing doc-support/result/docbook.rng manual-full.xml -out/html/index.html: manual-full.xml style.css highlightjs +out/html/index.html: doc-support/result manual-full.xml style.css highlightjs mkdir -p out/html xsltproc ${xsltFlags} \ --nonet --xinclude \ --output $@ \ - "$$XSL/docbook/xhtml/docbook.xsl" \ + doc-support/result/xsl/docbook/xhtml/docbook.xsl \ ./manual-full.xml mkdir -p out/html/highlightjs/ @@ -43,20 +43,20 @@ out/html/index.html: manual-full.xml style.css highlightjs cp ./style.css out/html/style.css mkdir -p out/html/images/callouts - cp "$$XSL/docbook/images/callouts/"*.svg out/html/images/callouts/ + cp doc-support/result/xsl/docbook/images/callouts/*.svg out/html/images/callouts/ chmod u+w -R out/html/ out/epub/manual.epub: manual-full.xml mkdir -p out/epub/scratch xsltproc ${xsltFlags} --nonet \ --output out/epub/scratch/ \ - "$$XSL/docbook/epub/docbook.xsl" \ + doc-support/result/xsl/docbook/epub/docbook.xsl \ ./manual-full.xml cp ./overrides.css out/epub/scratch/OEBPS cp ./style.css out/epub/scratch/OEBPS mkdir -p out/epub/scratch/OEBPS/images/callouts/ - cp "$$XSL/docbook/images/callouts/"*.svg out/epub/scratch/OEBPS/images/callouts/ + cp doc-support/result/xsl/docbook/images/callouts/*.svg out/epub/scratch/OEBPS/images/callouts/ echo "application/epub+zip" > mimetype zip -0Xq "out/epub/manual.epub" mimetype rm mimetype diff --git a/doc/default.nix b/doc/default.nix index 5a606981d8c29..718767f53b623 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -14,7 +14,6 @@ in pkgs.stdenv.mkDerivation { # $ nix-shell --run "make clean all" # otherwise they won't reapply :) HIGHLIGHTJS = pkgs.documentation-highlighter; - XSL = "${pkgs.docbook_xsl_ns}/xml/xsl"; XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf; xsltFlags = lib.concatStringsSep " " [ "--param section.autolabel 1" diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index 6cf7666ccf8d4..9e7335244595c 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -12,6 +12,7 @@ in pkgs.runCommand "doc-support" {} ln -s ${functionDocs} ./function-docs ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng + ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl echo -n "${version}" > ./version ) -- cgit 1.4.1 From de58e706f9965b90a8df98e3cc29ff4fcc22cb18 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:46:59 -0400 Subject: docs: Get highlightjs from build symlink --- doc/Makefile | 10 +++++----- doc/default.nix | 1 - doc/doc-support/default.nix | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index c127bea13c1e0..24ad42185f911 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -63,12 +63,12 @@ out/epub/manual.epub: manual-full.xml cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" * rm -rf "out/epub/scratch/" -highlightjs: +highlightjs: doc-support/result mkdir -p highlightjs - cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/ - cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/ - cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/ - cp -r "$$HIGHLIGHTJS/loader.js" highlightjs/ + cp -r doc-support/result/highlightjs/highlight.pack.js highlightjs/ + cp -r doc-support/result/highlightjs/LICENSE highlightjs/ + cp -r doc-support/result/highlightjs/mono-blue.css highlightjs/ + cp -r doc-support/result/highlightjs/loader.js highlightjs/ manual-full.xml: ${MD_TARGETS} .version functions/library/locations.xml functions/library/generated *.xml **/*.xml **/**/*.xml diff --git a/doc/default.nix b/doc/default.nix index 718767f53b623..7fed48c45e68b 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -13,7 +13,6 @@ in pkgs.stdenv.mkDerivation { # nix-shell between each test, maybe even: # $ nix-shell --run "make clean all" # otherwise they won't reapply :) - HIGHLIGHTJS = pkgs.documentation-highlighter; XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf; xsltFlags = lib.concatStringsSep " " [ "--param section.autolabel 1" diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index 9e7335244595c..ac9a6f52c8300 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -14,6 +14,8 @@ in pkgs.runCommand "doc-support" {} ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl + ln -s ${pkgs.documentation-highlighter} ./highlightjs + echo -n "${version}" > ./version ) mv result $out -- cgit 1.4.1 From 5a0696f6d0bf3344437eb1c83f1108e46664e24a Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 08:51:43 -0400 Subject: xmlformat.conf: move to doc-support build --- doc/Makefile | 4 ++-- doc/default.nix | 1 - doc/doc-support/default.nix | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 24ad42185f911..4bf33f7dd43b1 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -8,10 +8,10 @@ debug: nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml" .PHONY: format -format: +format: doc-support/result find . -iname '*.xml' -type f | while read f; do \ echo $$f ;\ - xmlformat --config-file "$$XMLFORMAT_CONFIG" -i $$f ;\ + xmlformat --config-file "doc-support/result/xmlformat.conf" -i $$f ;\ done .PHONY: fix-misc-xml diff --git a/doc/default.nix b/doc/default.nix index 7fed48c45e68b..971c60b35c2ad 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -13,7 +13,6 @@ in pkgs.stdenv.mkDerivation { # nix-shell between each test, maybe even: # $ nix-shell --run "make clean all" # otherwise they won't reapply :) - XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf; xsltFlags = lib.concatStringsSep " " [ "--param section.autolabel 1" "--param section.label.includes.component.label 1" diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index ac9a6f52c8300..c8be039fa7e04 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -14,6 +14,7 @@ in pkgs.runCommand "doc-support" {} ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl + ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf ln -s ${pkgs.documentation-highlighter} ./highlightjs echo -n "${version}" > ./version -- cgit 1.4.1 From fa47df617443b6bd7be0fe0239418c241df146c3 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 4 Jul 2019 09:06:39 -0400 Subject: doc: move parameters to an XML file --- doc/Makefile | 8 ++++---- doc/default.nix | 15 --------------- doc/doc-support/default.nix | 22 ++++++++++++++++++++++ doc/doc-support/parameters.xml | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 doc/doc-support/parameters.xml diff --git a/doc/Makefile b/doc/Makefile index 4bf33f7dd43b1..e7ca31b20d71b 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -30,10 +30,10 @@ validate: manual-full.xml doc-support/result out/html/index.html: doc-support/result manual-full.xml style.css highlightjs mkdir -p out/html - xsltproc ${xsltFlags} \ + xsltproc \ --nonet --xinclude \ --output $@ \ - doc-support/result/xsl/docbook/xhtml/docbook.xsl \ + doc-support/result/xhtml.xsl \ ./manual-full.xml mkdir -p out/html/highlightjs/ @@ -48,9 +48,9 @@ out/html/index.html: doc-support/result manual-full.xml style.css highlightjs out/epub/manual.epub: manual-full.xml mkdir -p out/epub/scratch - xsltproc ${xsltFlags} --nonet \ + xsltproc --nonet \ --output out/epub/scratch/ \ - doc-support/result/xsl/docbook/epub/docbook.xsl \ + doc-support/result/epub.xsl \ ./manual-full.xml cp ./overrides.css out/epub/scratch/OEBPS diff --git a/doc/default.nix b/doc/default.nix index 971c60b35c2ad..d9051167dee5d 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -9,21 +9,6 @@ in pkgs.stdenv.mkDerivation { src = ./.; - # Hacking on these variables? Make sure to close and open - # nix-shell between each test, maybe even: - # $ nix-shell --run "make clean all" - # otherwise they won't reapply :) - xsltFlags = lib.concatStringsSep " " [ - "--param section.autolabel 1" - "--param section.label.includes.component.label 1" - "--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'" - "--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'" - "--param xref.with.number.and.title 1" - "--param toc.section.depth 3" - "--stringparam admon.style ''" - "--stringparam callout.graphics.extension .svg" - ]; - postPatch = '' ln -s ${doc-support} ./doc-support/result ''; diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index c8be039fa7e04..53990b6771962 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -3,6 +3,26 @@ let locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; }; functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; }; version = pkgs.lib.version; + + epub-xsl = pkgs.writeText "epub.xsl" '' + + + + + + ''; + + xhtml-xsl = pkgs.writeText "xhtml.xsl" '' + + + + + + ''; in pkgs.runCommand "doc-support" {} '' mkdir result @@ -13,6 +33,8 @@ in pkgs.runCommand "doc-support" {} ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl + ln -s ${epub-xsl} ./epub.xsl + ln -s ${xhtml-xsl} ./xhtml.xsl ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf ln -s ${pkgs.documentation-highlighter} ./highlightjs diff --git a/doc/doc-support/parameters.xml b/doc/doc-support/parameters.xml new file mode 100644 index 0000000000000..bc13e2b70dec9 --- /dev/null +++ b/doc/doc-support/parameters.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + -- cgit 1.4.1