From 75092ccad23bdc21fb612545cc7bd4976b6d263c Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 15 Feb 2019 09:37:27 +0700 Subject: [PATCH] doc/manual: Switch to asciidoctor and other improvements --- doc/manual/.gitignore | 4 ++++ doc/manual/Makefile | 8 ++++++-- doc/manual/default.nix | 21 ++++++++++++++++++--- doc/manual/live-build | 3 +++ doc/manual/manual.xml | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 doc/manual/.gitignore create mode 100755 doc/manual/live-build diff --git a/doc/manual/.gitignore b/doc/manual/.gitignore new file mode 100644 index 0000000..9ddf569 --- /dev/null +++ b/doc/manual/.gitignore @@ -0,0 +1,4 @@ +introduction.xml +manual.html +options-composition.xml +options-service.xml diff --git a/doc/manual/Makefile b/doc/manual/Makefile index c7e0286..99f0d5f 100644 --- a/doc/manual/Makefile +++ b/doc/manual/Makefile @@ -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___' -e 's___' %.xml: %.asciidoc - asciidoc -b docbook -d book -a nolang $< + asciidoctor --backend docbook45 --doctype article $< sed -e 's///' -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) diff --git a/doc/manual/default.nix b/doc/manual/default.nix index d9f62ef..f56f3dc 100644 --- a/doc/manual/default.nix +++ b/doc/manual/default.nix @@ -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 + } + ''; }; } diff --git a/doc/manual/live-build b/doc/manual/live-build new file mode 100755 index 0000000..860d200 --- /dev/null +++ b/doc/manual/live-build @@ -0,0 +1,3 @@ +#!/usr/bin/env nix-shell +#!nix-shell -A manual +#!nix-shell --run live-build diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index fb37b2b..cd5a06e 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -16,7 +16,7 @@ - + Installation