doc/manual: Switch to asciidoctor and other improvements

This commit is contained in:
Robert Hensing 2019-02-15 09:37:27 +07:00
parent 0f7f7f2036
commit 75092ccad2
5 changed files with 32 additions and 6 deletions

4
doc/manual/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
introduction.xml
manual.html
options-composition.xml
options-service.xml

View file

@ -17,17 +17,21 @@ docbookxsl = http://docbook.sourceforge.net/release/xsl/current
all: manual.html
manual.html: manual.xml introduction.xml
manual.html: manual.xml introduction.xml options-composition.xml options-service.xml
$(xsltproc) --xinclude --stringparam profile.condition manual \
$(docbookxsl)/profiling/profile.xsl manual.xml | \
$(xsltproc) --output manual.html $(docbookxsl)/xhtml/docbook.xsl -
# -e 's_<book lang="en">__' -e 's_</book>__'
%.xml: %.asciidoc
asciidoc -b docbook -d book -a nolang $<
asciidoctor --backend docbook45 --doctype article $<
sed -e 's/<!DOCTYPE.*//' -e 's/<?asciidoc-toc?>//' -i $@
cat $@
options-composition.xml options-service.xml:
@if test -z '$(generatedDocBook)'; then echo "generatedDocBook env var is required. Are you running in 'nix-shell -A manual'?"; exit 1; fi
cp $(generatedDocBook)/* .
install: all
mkdir -p $(docdir)
cp manual.html style.css $(docdir)

View file

@ -1,4 +1,4 @@
{ pkgs ? import ../../nix {}, version ? "unreleased" }:
{ pkgs ? import ../../nix {}, version ? "local" }:
let
inherit (pkgs) recurseIntoAttrs callPackage runCommand lib stdenv ;
@ -68,14 +68,22 @@ recurseIntoAttrs rec {
ln -s ${serviceOptions.optionsDocBook} $out/options-service.xml
'';
manual = stdenv.mkDerivation {
src = ./.;
src = lib.sourceByRegex ./. [
"Makefile$"
".*\.asciidoc$"
".*\.xsl$"
".*\.css$"
"^manual.xml$"
"^manual.xml$"
];
name = "arion-manual";
version = version;
buildInputs = [
(pkgs.libxslt.bin or pkgs.libxslt)
pkgs.asciidoc
pkgs.asciidoctor
];
XML_CATALOG_FILES = "${pkgs.docbook_xsl}/xml/xsl/docbook/catalog.xml";
inherit generatedDocBook;
configurePhase = ''
export docdir=$out/doc
'';
@ -98,5 +106,12 @@ recurseIntoAttrs rec {
ls -R
set +x
'';
shellHook = ''
live-build() {
inotifywait -e MODIFY -m -r . | while read; do
make
done
}
'';
};
}

3
doc/manual/live-build Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env nix-shell
#!nix-shell -A manual
#!nix-shell --run live-build

View file

@ -16,7 +16,7 @@
</info>
<xi:include href="introduction.xml" xpointer="xpointer(/book/chapter)" />
<xi:include href="introduction.xml" xpointer="xpointer(/article/section)" />
<chapter>
<title>Installation</title>