summaryrefslogtreecommitdiffstats
path: root/doc/Makefile
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-03-26 08:24:27 -0400
committerGraham Christensen <graham@grahamc.com>2018-03-26 21:44:24 -0400
commit8dac5ce146c0c3afe963ea8bc955d5b147853345 (patch)
treefde04ea30558c36bd80d810d3024e1696bd6d306 /doc/Makefile
parent378e05c6ddcc213652e51c9bdaa5d54c66959156 (diff)
nixpkgs docs: syntax highlight
Diffstat (limited to 'doc/Makefile')
-rw-r--r--doc/Makefile24
1 files changed, 21 insertions, 3 deletions
diff --git a/doc/Makefile b/doc/Makefile
index b76ea9ed59e4..c16e70e9c6a2 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -6,16 +6,17 @@ all: validate out/html/index.html out/epub/manual.epub
.PHONY: debug
debug:
nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
+
.PHONY: clean
clean:
rm -f ${MD_TARGETS} .version manual-full.xml
- rm -rf ./out/
+ rm -rf ./out/ ./highlightjs
.PHONY: validate
validate: manual-full.xml
jing "$$RNG" manual-full.xml
-out/html/index.html: manual-full.xml style.css
+out/html/index.html: manual-full.xml style.css highlightjs
mkdir -p out/html
xsltproc ${xsltFlags} \
--nonet --xinclude \
@@ -23,12 +24,22 @@ out/html/index.html: manual-full.xml style.css
"$$XSL/docbook/xhtml/docbook.xsl" \
./manual-full.xml
+ mkdir -p out/html/highlightjs/
+ echo "document.onreadystatechange = function () { \
+ var listings = document.querySelectorAll('.programlisting, .screen'); \
+ for (i = 0; i < listings.length; ++i) { \
+ hljs.highlightBlock(listings[i]); \
+ } \
+ } " > out/html/highlightjs/loader.js
+
+ cp -r highlightjs out/html/
+
cp ./overrides.css out/html/
cp ./style.css out/html/style.css
mkdir -p out/html/images/callouts
cp "$$XSL/docbook/images/callouts/"*.svg out/html/images/callouts/
- chmod u+w -R out/html/images/
+ chmod u+w -R out/html/
out/epub/manual.epub: manual-full.xml
mkdir -p out/epub/scratch
@@ -47,6 +58,13 @@ out/epub/manual.epub: manual-full.xml
cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" *
rm -rf "out/epub/scratch/"
+highlightjs:
+ mkdir -p highlightjs
+ cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/
+ cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/
+ cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/
+
+
manual-full.xml: ${MD_TARGETS} .version *.xml
xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml