Merge pull request #64301 from grahamc/docs/clean-build
Docs/clean build
This commit is contained in:
commit
e9451ebc9b
53
doc/Makefile
53
doc/Makefile
|
@ -8,10 +8,10 @@ debug:
|
||||||
nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
|
nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
|
||||||
|
|
||||||
.PHONY: format
|
.PHONY: format
|
||||||
format:
|
format: doc-support/result
|
||||||
find . -iname '*.xml' -type f | while read f; do \
|
find . -iname '*.xml' -type f | while read f; do \
|
||||||
echo $$f ;\
|
echo $$f ;\
|
||||||
xmlformat --config-file "$$XMLFORMAT_CONFIG" -i $$f ;\
|
xmlformat --config-file "doc-support/result/xmlformat.conf" -i $$f ;\
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: fix-misc-xml
|
.PHONY: fix-misc-xml
|
||||||
|
@ -21,19 +21,19 @@ fix-misc-xml:
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
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
|
rm -rf ./out/ ./highlightjs
|
||||||
|
|
||||||
.PHONY: validate
|
.PHONY: validate
|
||||||
validate: manual-full.xml
|
validate: manual-full.xml doc-support/result
|
||||||
jing "$$RNG" manual-full.xml
|
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
|
mkdir -p out/html
|
||||||
xsltproc ${xsltFlags} \
|
xsltproc \
|
||||||
--nonet --xinclude \
|
--nonet --xinclude \
|
||||||
--output $@ \
|
--output $@ \
|
||||||
"$$XSL/docbook/xhtml/docbook.xsl" \
|
doc-support/result/xhtml.xsl \
|
||||||
./manual-full.xml
|
./manual-full.xml
|
||||||
|
|
||||||
mkdir -p out/html/highlightjs/
|
mkdir -p out/html/highlightjs/
|
||||||
|
@ -43,49 +43,48 @@ out/html/index.html: manual-full.xml style.css highlightjs
|
||||||
cp ./style.css out/html/style.css
|
cp ./style.css out/html/style.css
|
||||||
|
|
||||||
mkdir -p out/html/images/callouts
|
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/
|
chmod u+w -R out/html/
|
||||||
|
|
||||||
out/epub/manual.epub: manual-full.xml
|
out/epub/manual.epub: manual-full.xml
|
||||||
mkdir -p out/epub/scratch
|
mkdir -p out/epub/scratch
|
||||||
xsltproc ${xsltFlags} --nonet \
|
xsltproc --nonet \
|
||||||
--output out/epub/scratch/ \
|
--output out/epub/scratch/ \
|
||||||
"$$XSL/docbook/epub/docbook.xsl" \
|
doc-support/result/epub.xsl \
|
||||||
./manual-full.xml
|
./manual-full.xml
|
||||||
|
|
||||||
cp ./overrides.css out/epub/scratch/OEBPS
|
cp ./overrides.css out/epub/scratch/OEBPS
|
||||||
cp ./style.css out/epub/scratch/OEBPS
|
cp ./style.css out/epub/scratch/OEBPS
|
||||||
mkdir -p out/epub/scratch/OEBPS/images/callouts/
|
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
|
echo "application/epub+zip" > mimetype
|
||||||
zip -0Xq "out/epub/manual.epub" mimetype
|
zip -0Xq "out/epub/manual.epub" mimetype
|
||||||
rm mimetype
|
rm mimetype
|
||||||
cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" *
|
cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" *
|
||||||
rm -rf "out/epub/scratch/"
|
rm -rf "out/epub/scratch/"
|
||||||
|
|
||||||
highlightjs:
|
highlightjs: doc-support/result
|
||||||
mkdir -p highlightjs
|
mkdir -p highlightjs
|
||||||
cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/
|
cp -r doc-support/result/highlightjs/highlight.pack.js highlightjs/
|
||||||
cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/
|
cp -r doc-support/result/highlightjs/LICENSE highlightjs/
|
||||||
cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/
|
cp -r doc-support/result/highlightjs/mono-blue.css highlightjs/
|
||||||
cp -r "$$HIGHLIGHTJS/loader.js" 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
|
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
|
xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
|
||||||
|
|
||||||
.version:
|
.version: doc-support/result
|
||||||
nix-instantiate --eval \
|
ln -rfs ./doc-support/result/version .version
|
||||||
-E '(import ../lib).version' > .version
|
|
||||||
|
|
||||||
functions/library/locations.xml:
|
doc-support/result: doc-support/default.nix
|
||||||
nix-build ./lib-function-locations.nix \
|
(cd doc-support; nix-build)
|
||||||
--out-link $@
|
|
||||||
|
|
||||||
functions/library/generated: functions/library/locations.xml
|
functions/library/locations.xml: doc-support/result
|
||||||
nix-build ./lib-function-docs.nix \
|
ln -rfs ./doc-support/result/function-locations.xml functions/library/locations.xml
|
||||||
--arg locationsXml $< \
|
|
||||||
--out-link $@
|
functions/library/generated: doc-support/result
|
||||||
|
ln -rfs ./doc-support/result/function-docs functions/library/generated
|
||||||
|
|
||||||
%.section.xml: %.section.md
|
%.section.xml: %.section.md
|
||||||
pandoc $^ -w docbook+smart \
|
pandoc $^ -w docbook+smart \
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
|
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; };
|
doc-support = import ./doc-support { inherit pkgs nixpkgs; };
|
||||||
functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; };
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "nixpkgs-manual";
|
name = "nixpkgs-manual";
|
||||||
|
|
||||||
|
@ -10,30 +9,8 @@ in pkgs.stdenv.mkDerivation {
|
||||||
|
|
||||||
src = ./.;
|
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 :)
|
|
||||||
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"
|
|
||||||
"--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 = ''
|
postPatch = ''
|
||||||
rm -rf ./functions/library/locations.xml
|
ln -s ${doc-support} ./doc-support/result
|
||||||
ln -s ${locationsXml} ./functions/library/locations.xml
|
|
||||||
ln -s ${functionDocs} ./functions/library/generated
|
|
||||||
echo ${lib.version} > .version
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
45
doc/doc-support/default.nix
Normal file
45
doc/doc-support/default.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
|
||||||
|
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" ''
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
<xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl" />
|
||||||
|
<xsl:import href="${./parameters.xml}"/>
|
||||||
|
</xsl:stylesheet>
|
||||||
|
'';
|
||||||
|
|
||||||
|
xhtml-xsl = pkgs.writeText "xhtml.xsl" ''
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
<xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/xhtml/docbook.xsl" />
|
||||||
|
<xsl:import href="${./parameters.xml}"/>
|
||||||
|
</xsl:stylesheet>
|
||||||
|
'';
|
||||||
|
in pkgs.runCommand "doc-support" {}
|
||||||
|
''
|
||||||
|
mkdir result
|
||||||
|
(
|
||||||
|
cd result
|
||||||
|
ln -s ${locationsXml} ./function-locations.xml
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
echo -n "${version}" > ./version
|
||||||
|
)
|
||||||
|
mv result $out
|
||||||
|
''
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
with pkgs; stdenv.mkDerivation {
|
with pkgs; stdenv.mkDerivation {
|
||||||
name = "nixpkgs-lib-docs";
|
name = "nixpkgs-lib-docs";
|
||||||
src = ./../lib;
|
src = ./../../lib;
|
||||||
|
|
||||||
buildInputs = [ nixdoc ];
|
buildInputs = [ nixdoc ];
|
||||||
installPhase = ''
|
installPhase = ''
|
14
doc/doc-support/parameters.xml
Normal file
14
doc/doc-support/parameters.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
<xsl:param name="section.autolabel" select="1" />
|
||||||
|
<xsl:param name="section.label.includes.component.label" select="1" />
|
||||||
|
<xsl:param name="html.stylesheet" select="'style.css overrides.css highlightjs/mono-blue.css'" />
|
||||||
|
<xsl:param name="html.script" select="'./highlightjs/highlight.pack.js ./highlightjs/loader.js'" />
|
||||||
|
<xsl:param name="xref.with.number.and.title" select="1" />
|
||||||
|
<xsl:param name="use.id.as.filename" select="1" />
|
||||||
|
<xsl:param name="toc.section.depth" select="3" />
|
||||||
|
<xsl:param name="admon.style" select="''" />
|
||||||
|
<xsl:param name="callout.graphics.extension" select="'.svg'" />
|
||||||
|
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user