1 MD_TARGETS
=$(addsuffix .xml
, $(basename $(shell find .
-type f
-regex
'.*\.md$$' -not
-name README.md
)))
5 pandoc_media_dir
= media
6 # NOTE: Keep in sync with NixOS manual (/nixos/doc/manual/md-to-db.sh).
7 # TODO: Remove raw-attribute when we can get rid of DocBook altogether.
8 pandoc_commonmark_enabled_extensions
= +attributes
+fenced_divs
+footnotes
+bracketed_spans
+definition_lists
+pipe_tables
+raw_attribute
9 pandoc_flags
= --extract-media
=$(pandoc_media_dir
) \
10 --lua-filter
=$(PANDOC_LUA_FILTERS_DIR
)/diagram-generator.lua \
11 --lua-filter
=labelless-link-is-xref.lua \
12 -f commonmark
$(pandoc_commonmark_enabled_extensions
)+smart
15 all: validate format out
/html
/index.html out
/epub
/manual.epub
19 nix-shell
--run
"xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
22 format
: doc-support
/result
23 find .
-iname
'*.xml' -type f | while read f
; do \
25 xmlformat
--config-file
"doc-support/result/xmlformat.conf" -i
$$f ;\
30 find .
-iname
'*.xml' -type f \
31 -exec ..
/nixos
/doc
/varlistentry-fixer.rb
{} ';'
35 rm -f
${MD_TARGETS} doc-support
/result .version manual-full.xml functions
/library
/locations.xml functions
/library
/generated
36 rm -rf .
/out
/ .
/highlightjs .
/media
39 validate
: manual-full.xml doc-support
/result
40 jing doc-support
/result
/docbook.rng manual-full.xml
42 out
/html
/index.html
: doc-support
/result manual-full.xml style.css highlightjs
47 doc-support
/result
/xhtml.xsl \
50 mkdir
-p out
/html
/highlightjs
/
51 cp
-r highlightjs out
/html
/
53 cp
-r
$(pandoc_media_dir
) out
/html
/
54 cp .
/overrides.css out
/html
/
55 cp .
/style.css out
/html
/style.css
57 mkdir
-p out
/html
/images
/callouts
58 cp doc-support
/result
/xsl
/docbook
/images
/callouts
/*.svg out
/html
/images
/callouts
/
59 chmod u
+w
-R out
/html
/
61 out
/epub
/manual.epub
: manual-full.xml
62 mkdir
-p out
/epub
/scratch
64 --output out
/epub
/scratch
/ \
65 doc-support
/result
/epub.xsl \
68 cp
-r
$(pandoc_media_dir
) out
/epub
/scratch
/OEBPS
69 cp .
/overrides.css out
/epub
/scratch
/OEBPS
70 cp .
/style.css out
/epub
/scratch
/OEBPS
71 mkdir
-p out
/epub
/scratch
/OEBPS
/images
/callouts
/
72 cp doc-support
/result
/xsl
/docbook
/images
/callouts
/*.svg out
/epub
/scratch
/OEBPS
/images
/callouts
/
73 echo
"application/epub+zip" > mimetype
74 zip
-0Xq
"out/epub/manual.epub" mimetype
76 cd
"out/epub/scratch/" && zip
-Xr9D
"../manual.epub" *
77 rm -rf
"out/epub/scratch/"
79 highlightjs
: doc-support
/result
81 cp
-r doc-support
/result
/highlightjs
/highlight.pack.js highlightjs
/
82 cp
-r doc-support
/result
/highlightjs
/LICENSE highlightjs
/
83 cp
-r doc-support
/result
/highlightjs
/mono-blue.css highlightjs
/
84 cp
-r doc-support
/result
/highlightjs
/loader.js highlightjs
/
87 manual-full.xml
: ${MD_TARGETS} .version functions
/library
/locations.xml functions
/library
/generated
*.xml
**/*.xml
**/**/*.xml
88 xmllint
--nonet
--xinclude
--noxincludenode manual.xml
--output manual-full.xml
90 .version
: doc-support
/result
91 ln
-rfs .
/doc-support
/result
/version .version
93 doc-support
/result
: doc-support
/default.nix
94 (cd doc-support
; nix-build
)
96 functions
/library
/locations.xml
: doc-support
/result
97 ln
-rfs .
/doc-support
/result
/function-locations.xml functions
/library
/locations.xml
99 functions
/library
/generated
: doc-support
/result
100 ln
-rfs .
/doc-support
/result
/function-docs functions
/library
/generated
102 %.section.xml
: %.section.md
103 $(PANDOC
) $^
-t docbook \
107 %.chapter.xml
: %.chapter.md
108 $(PANDOC
) $^
-t docbook \
109 --top-level-division
=chapter \