···
pkgs.stdenv.mkDerivation {
buildInputs = with pkgs; [ pandoc libxml2 libxslt zip ];
14
-
--param section.autolabel 1
15
-
--param section.label.includes.component.label 1
16
-
--param html.stylesheet 'style.css'
17
-
--param xref.with.number.and.title 1
18
-
--param toc.section.depth 3
19
-
--param admon.style '''
20
-
--param callout.graphics.extension '.gif'
14
+
XSL = "${pkgs.docbook5_xsl}/xml/xsl";
15
+
RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng";
16
+
xsltFlags = lib.concatStringsSep " " [
17
+
"--param section.autolabel 1"
18
+
"--param section.label.includes.component.label 1"
19
+
"--param html.stylesheet 'style.css'"
20
+
"--param xref.with.number.and.title 1"
21
+
"--param toc.section.depth 3"
22
+
"--param admon.style ''"
23
+
"--param callout.graphics.extension '.gif'"
24
-
buildCommand = let toDocbook = { useChapters ? false, inputFile, outputFile }:
26
-
extraHeader = lib.optionalString (!useChapters)
27
-
''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
30
-
pandoc '${inputFile}' -w docbook+smart ${lib.optionalString useChapters "--top-level-division=chapter"} \
32
-
| sed -e 's|<ulink url=|<link xlink:href=|' \
33
-
-e 's|</ulink>|</link>|' \
34
-
-e 's|<sect. id=|<section xml:id=|' \
35
-
-e 's|</sect[0-9]>|</section>|' \
36
-
-e '1s| id=| xml:id=|' \
37
-
-e '1s|\(<[^ ]* \)|\1${extraHeader}|'
43
-
ln -s '${sources}/'*.xml .
44
-
mkdir ./languages-frameworks
45
-
cp -s '${sources-langs}'/* ./languages-frameworks
48
-
inputFile = ./introduction.chapter.md;
49
-
outputFile = "introduction.chapter.xml";
53
-
inputFile = ./shell.section.md;
54
-
outputFile = "shell.section.xml";
57
-
inputFile = ./languages-frameworks/python.section.md;
58
-
outputFile = "./languages-frameworks/python.section.xml";
61
-
inputFile = ./languages-frameworks/haskell.section.md;
62
-
outputFile = "./languages-frameworks/haskell.section.xml";
65
-
inputFile = ./languages-frameworks/idris.section.md;
66
-
outputFile = "languages-frameworks/idris.section.xml";
69
-
inputFile = ./languages-frameworks/node.section.md;
70
-
outputFile = "languages-frameworks/node.section.xml";
73
-
inputFile = ./languages-frameworks/r.section.md;
74
-
outputFile = "languages-frameworks/r.section.xml";
77
-
inputFile = ./languages-frameworks/rust.section.md;
78
-
outputFile = "./languages-frameworks/rust.section.xml";
81
-
inputFile = ./languages-frameworks/vim.section.md;
82
-
outputFile = "./languages-frameworks/vim.section.xml";
85
-
inputFile = ./languages-frameworks/emscripten.section.md;
86
-
outputFile = "./languages-frameworks/emscripten.section.xml";
echo ${lib.nixpkgsVersion} > .version
91
-
# validate against relaxng schema
92
-
xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
93
-
${pkgs.jing}/bin/jing ${pkgs.docbook5}/xml/rng/docbook/docbook.rng manual-full.xml
95
-
dst=$out/share/doc/nixpkgs
97
-
xsltproc $xsltFlags --nonet --xinclude \
98
-
--output $dst/manual.html \
99
-
${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
102
-
cp ${./style.css} $dst/style.css
31
+
dest="$out/share/doc/nixpkgs"
32
+
mkdir -p "$(dirname "$dest")"
34
+
mv "$dest/index.html" "$dest/manual.html"
104
-
mkdir -p $dst/images/callouts
105
-
cp "${pkgs.docbook5_xsl}/xml/xsl/docbook/images/callouts/"*.gif $dst/images/callouts/
36
+
mv out/epub/manual.epub "$dest/nixpkgs-manual.epub"
107
-
mkdir -p $out/nix-support
108
-
echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
110
-
xsltproc $xsltFlags --nonet --xinclude \
111
-
--output $dst/epub/ \
112
-
${pkgs.docbook5_xsl}/xml/xsl/docbook/epub/docbook.xsl \
115
-
cp -r $dst/images $dst/epub/OEBPS
116
-
echo "application/epub+zip" > mimetype
117
-
manual="$dst/nixpkgs-manual.epub"
118
-
zip -0Xq "$manual" mimetype
119
-
cd $dst/epub && zip -Xr9D "$manual" *
38
+
mkdir -p $out/nix-support/
39
+
echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products