mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
nixos/manual: render html with nixos-render-doc if !allowDocBook
this reproduces the docbook-generated html manual exactly enough to appease the compare workflows while we still support both toolchains. it's also a lot faster than the docbook toolchain, rendering the entire html manual in about two seconds on this machine (while docbook needs about 20).
This commit is contained in:
parent
36f04733dd
commit
54f4992e80
|
@ -135,12 +135,7 @@ let
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
manual-combined = runCommand "nixos-manual-combined"
|
prepareManualFromMD = ''
|
||||||
{ inputs = lib.sourceFilesBySuffices ./. [ ".xml" ".md" ];
|
|
||||||
nativeBuildInputs = [ pkgs.nixos-render-docs pkgs.libxml2.bin pkgs.libxslt.bin ];
|
|
||||||
meta.description = "The NixOS manual as plain docbook XML";
|
|
||||||
}
|
|
||||||
''
|
|
||||||
cp -r --no-preserve=all $inputs/* .
|
cp -r --no-preserve=all $inputs/* .
|
||||||
|
|
||||||
substituteInPlace ./manual.md \
|
substituteInPlace ./manual.md \
|
||||||
|
@ -157,6 +152,15 @@ let
|
||||||
--replace \
|
--replace \
|
||||||
'@NIXOS_TEST_OPTIONS_JSON@' \
|
'@NIXOS_TEST_OPTIONS_JSON@' \
|
||||||
${testOptionsDoc.optionsJSON}/share/doc/nixos/options.json
|
${testOptionsDoc.optionsJSON}/share/doc/nixos/options.json
|
||||||
|
'';
|
||||||
|
|
||||||
|
manual-combined = runCommand "nixos-manual-combined"
|
||||||
|
{ inputs = lib.sourceFilesBySuffices ./. [ ".xml" ".md" ];
|
||||||
|
nativeBuildInputs = [ pkgs.nixos-render-docs pkgs.libxml2.bin pkgs.libxslt.bin ];
|
||||||
|
meta.description = "The NixOS manual as plain docbook XML";
|
||||||
|
}
|
||||||
|
''
|
||||||
|
${prepareManualFromMD}
|
||||||
|
|
||||||
nixos-render-docs -j $NIX_BUILD_CORES manual docbook \
|
nixos-render-docs -j $NIX_BUILD_CORES manual docbook \
|
||||||
--manpage-urls ${manpageUrls} \
|
--manpage-urls ${manpageUrls} \
|
||||||
|
@ -193,7 +197,14 @@ in rec {
|
||||||
|
|
||||||
# Generate the NixOS manual.
|
# Generate the NixOS manual.
|
||||||
manualHTML = runCommand "nixos-manual-html"
|
manualHTML = runCommand "nixos-manual-html"
|
||||||
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
|
{ nativeBuildInputs =
|
||||||
|
if allowDocBook then [
|
||||||
|
buildPackages.libxml2.bin
|
||||||
|
buildPackages.libxslt.bin
|
||||||
|
] else [
|
||||||
|
buildPackages.nixos-render-docs
|
||||||
|
];
|
||||||
|
inputs = lib.optionals (! allowDocBook) (lib.sourceFilesBySuffices ./. [ ".md" ]);
|
||||||
meta.description = "The NixOS manual in HTML format";
|
meta.description = "The NixOS manual in HTML format";
|
||||||
allowedReferences = ["out"];
|
allowedReferences = ["out"];
|
||||||
}
|
}
|
||||||
|
@ -201,6 +212,12 @@ in rec {
|
||||||
# Generate the HTML manual.
|
# Generate the HTML manual.
|
||||||
dst=$out/share/doc/nixos
|
dst=$out/share/doc/nixos
|
||||||
mkdir -p $dst
|
mkdir -p $dst
|
||||||
|
|
||||||
|
cp ${../../../doc/style.css} $dst/style.css
|
||||||
|
cp ${../../../doc/overrides.css} $dst/overrides.css
|
||||||
|
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
|
||||||
|
|
||||||
|
${if allowDocBook then ''
|
||||||
xsltproc \
|
xsltproc \
|
||||||
${manualXsltprocOptions} \
|
${manualXsltprocOptions} \
|
||||||
--stringparam id.warnings "1" \
|
--stringparam id.warnings "1" \
|
||||||
|
@ -213,10 +230,25 @@ in rec {
|
||||||
|
|
||||||
mkdir -p $dst/images/callouts
|
mkdir -p $dst/images/callouts
|
||||||
cp ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
|
cp ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
|
||||||
|
'' else ''
|
||||||
|
${prepareManualFromMD}
|
||||||
|
|
||||||
cp ${../../../doc/style.css} $dst/style.css
|
# TODO generator is set like this because the docbook/md manual compare workflow will
|
||||||
cp ${../../../doc/overrides.css} $dst/overrides.css
|
# trigger if it's different
|
||||||
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
|
nixos-render-docs -j $NIX_BUILD_CORES manual html \
|
||||||
|
--manpage-urls ${manpageUrls} \
|
||||||
|
--revision ${lib.escapeShellArg revision} \
|
||||||
|
--generator "DocBook XSL Stylesheets V${docbook_xsl_ns.version}" \
|
||||||
|
--stylesheet style.css \
|
||||||
|
--stylesheet overrides.css \
|
||||||
|
--stylesheet highlightjs/mono-blue.css \
|
||||||
|
--script ./highlightjs/highlight.pack.js \
|
||||||
|
--script ./highlightjs/loader.js \
|
||||||
|
--toc-depth 1 \
|
||||||
|
--chunk-toc-depth 1 \
|
||||||
|
./manual.md \
|
||||||
|
$dst/index.html
|
||||||
|
''}
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
|
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
|
||||||
|
|
|
@ -47,7 +47,10 @@ development/development.md
|
||||||
contributing-to-this-manual.chapter.md
|
contributing-to-this-manual.chapter.md
|
||||||
```
|
```
|
||||||
|
|
||||||
```{=include=} appendix
|
```{=include=} appendix html:into-file=//options.html
|
||||||
nixos-options.md
|
nixos-options.md
|
||||||
|
```
|
||||||
|
|
||||||
|
```{=include=} appendix html:into-file=//release-notes.html
|
||||||
release-notes/release-notes.md
|
release-notes/release-notes.md
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue