Use mdbook

This commit is contained in:
Eelco Dolstra 2020-07-22 20:27:23 +02:00
parent 650ae14ced
commit e0ea3c82ca
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
9 changed files with 32 additions and 70 deletions

View file

@ -117,8 +117,6 @@ fi
]) ])
NEED_PROG(bash, bash) NEED_PROG(bash, bash)
AC_PATH_PROG(xmllint, xmllint, false)
AC_PATH_PROG(xsltproc, xsltproc, false)
AC_PATH_PROG(flex, flex, false) AC_PATH_PROG(flex, flex, false)
AC_PATH_PROG(bison, bison, false) AC_PATH_PROG(bison, bison, false)
AC_PATH_PROG(dot, dot) AC_PATH_PROG(dot, dot)

View file

@ -1,84 +1,39 @@
ifeq ($(doc_generate),yes) ifeq ($(doc_generate),yes)
XSLTPROC = $(xsltproc) --nonet $(xmlflags) \ MANUAL_SRCS := $(call rwildcard, $(d)/src, *.md)
--param section.autolabel 1 \
--param section.label.includes.component.label 1 \
--param xref.with.number.and.title 1 \
--param toc.section.depth 3 \
--param admon.style \'\' \
--param callout.graphics 0 \
--param contrib.inline.enabled 0 \
--stringparam generate.toc "book toc" \
--param keep.relative.image.uris 0
docbookxsl = http://docbook.sourceforge.net/release/xsl-ns/current #$(d)/version.txt:
docbookrng = http://docbook.org/xml/5.0/rng/docbook.rng # $(trace-gen) echo -n $(PACKAGE_VERSION) > $@
MANUAL_SRCS := $(call rwildcard, $(d), *.xml) clean-files += $(d)/version.txt
dist-files += $(d)/version.txt
# Do XInclude processing / RelaxNG validation
$(d)/manual.xmli: $(d)/manual.xml $(MANUAL_SRCS) $(d)/version.txt
$(trace-gen) $(xmllint) --nonet --xinclude $< -o $@.tmp
@mv $@.tmp $@
$(d)/version.txt:
$(trace-gen) echo -n $(PACKAGE_VERSION) > $@
# Note: RelaxNG validation requires xmllint >= 2.7.4.
$(d)/manual.is-valid: $(d)/manual.xmli
$(trace-gen) $(XSLTPROC) --novalid --stringparam profile.condition manual \
$(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \
$(xmllint) --nonet --noout --relaxng $(docbookrng) -
@touch $@
clean-files += $(d)/manual.xmli $(d)/version.txt $(d)/manual.is-valid
dist-files += $(d)/manual.xmli $(d)/version.txt $(d)/manual.is-valid
# Generate man pages. # Generate man pages.
man-pages := $(foreach n, \ man-pages := $(foreach n, \
nix-env.1 nix-build.1 nix-shell.1 nix-store.1 nix-instantiate.1 \ nix-copy-closure.1, \
nix-collect-garbage.1 \
nix-prefetch-url.1 nix-channel.1 \
nix-hash.1 nix-copy-closure.1 \
nix.conf.5 nix-daemon.8, \
$(d)/$(n)) $(d)/$(n))
# nix-env.1 nix-build.1 nix-shell.1 nix-store.1 nix-instantiate.1 \
$(firstword $(man-pages)): $(d)/manual.xmli $(d)/manual.is-valid # nix-collect-garbage.1, \
$(trace-gen) $(XSLTPROC) --novalid --stringparam profile.condition manpage \ # nix-prefetch-url.1 nix-channel.1 \
$(docbookxsl)/profiling/profile.xsl $< 2> /dev/null | \ # nix-hash.1 nix-copy-closure.1 \
(cd doc/manual && $(XSLTPROC) $(docbookxsl)/manpages/docbook.xsl -) # nix.conf.5 nix-daemon.8, \
$(wordlist 2, $(words $(man-pages)), $(man-pages)): $(firstword $(man-pages))
clean-files += $(d)/*.1 $(d)/*.5 $(d)/*.8 clean-files += $(d)/*.1 $(d)/*.5 $(d)/*.8
dist-files += $(man-pages) dist-files += $(man-pages)
$(d)/nix-copy-closure.1: $(d)/src/command-ref/nix-copy-closure.md
%.1: %.md
$(trace-gen) lowdown -sT man $^ -o $@
# Generate the HTML manual. # Generate the HTML manual.
$(d)/manual.html: $(d)/manual.xml $(MANUAL_SRCS) $(d)/manual.is-valid install: $(docdir)/manual/index.html
$(trace-gen) $(XSLTPROC) --xinclude --stringparam profile.condition manual \
$(docbookxsl)/profiling/profile.xsl $< | \
$(XSLTPROC) --output $@ $(docbookxsl)/xhtml/docbook.xsl -
$(foreach file, $(d)/manual.html, $(eval $(call install-data-in, $(file), $(docdir)/manual))) $(docdir)/manual/index.html: $(MANUAL_SRCS)
$(trace-gen) mdbook build doc/manual -d $(docdir)/manual
$(foreach file, $(wildcard $(d)/figures/*.png), $(eval $(call install-data-in, $(file), $(docdir)/manual/figures)))
$(eval $(call install-symlink, manual.html, $(docdir)/manual/index.html))
all: $(d)/manual.html
clean-files += $(d)/manual.html
dist-files += $(d)/manual.html
endif endif

View file

@ -0,0 +1,7 @@
# Table of Contents
- [Introduction](./introduction.md)
- [Quick Start](./quick-start.md)
- [Command Reference](./command-ref/command-ref.md)
- [Utilities](./command-ref/utilities.md)
- [nix-copy-closure](./command-ref/nix-copy-closure.md)

View file

@ -0,0 +1,2 @@
This section lists commands and options that you can use when you
work with Nix.

View file

@ -0,0 +1,3 @@
# Utilities
This section lists utilities that you can use when you work with Nix.

View file

@ -1,4 +1,4 @@
# About Nix # Introduction
Nix is a _purely functional package manager_. This means that it Nix is a _purely functional package manager_. This means that it
treats packages like values in purely functional programming languages treats packages like values in purely functional programming languages

View file

@ -62,10 +62,7 @@
buildDeps = buildDeps =
[ bison [ bison
flex flex
libxml2 mdbook
libxslt
docbook5
docbook_xsl_ns
lowdown lowdown
autoconf-archive autoconf-archive
autoreconfHook autoreconfHook