tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixpkgs docs: syntax highlight
Graham Christensen
8 years ago
8dac5ce1
378e05c6
+30
-5
4 changed files
expand all
collapse all
unified
split
doc
.gitignore
Makefile
default.nix
style.css
+1
doc/.gitignore
reviewed
···
3
3
.version
4
4
out
5
5
manual-full.xml
6
6
+
highlightjs
+21
-3
doc/Makefile
reviewed
···
6
6
.PHONY: debug
7
7
debug:
8
8
nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
9
9
+
9
10
.PHONY: clean
10
11
clean:
11
12
rm -f ${MD_TARGETS} .version manual-full.xml
12
12
-
rm -rf ./out/
13
13
+
rm -rf ./out/ ./highlightjs
13
14
14
15
.PHONY: validate
15
16
validate: manual-full.xml
16
17
jing "$$RNG" manual-full.xml
17
18
18
18
-
out/html/index.html: manual-full.xml style.css
19
19
+
out/html/index.html: manual-full.xml style.css highlightjs
19
20
mkdir -p out/html
20
21
xsltproc ${xsltFlags} \
21
22
--nonet --xinclude \
···
23
24
"$$XSL/docbook/xhtml/docbook.xsl" \
24
25
./manual-full.xml
25
26
27
27
+
mkdir -p out/html/highlightjs/
28
28
+
echo "document.onreadystatechange = function () { \
29
29
+
var listings = document.querySelectorAll('.programlisting, .screen'); \
30
30
+
for (i = 0; i < listings.length; ++i) { \
31
31
+
hljs.highlightBlock(listings[i]); \
32
32
+
} \
33
33
+
} " > out/html/highlightjs/loader.js
34
34
+
35
35
+
cp -r highlightjs out/html/
36
36
+
26
37
cp ./overrides.css out/html/
27
38
cp ./style.css out/html/style.css
28
39
29
40
mkdir -p out/html/images/callouts
30
41
cp "$$XSL/docbook/images/callouts/"*.svg out/html/images/callouts/
31
31
-
chmod u+w -R out/html/images/
42
42
+
chmod u+w -R out/html/
32
43
33
44
out/epub/manual.epub: manual-full.xml
34
45
mkdir -p out/epub/scratch
···
46
57
rm mimetype
47
58
cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" *
48
59
rm -rf "out/epub/scratch/"
60
60
+
61
61
+
highlightjs:
62
62
+
mkdir -p highlightjs
63
63
+
cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/
64
64
+
cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/
65
65
+
cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/
66
66
+
49
67
50
68
manual-full.xml: ${MD_TARGETS} .version *.xml
51
69
xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
+7
-1
doc/default.nix
reviewed
···
11
11
12
12
src = ./.;
13
13
14
14
+
# Hacking on these variables? Make sure to close and open
15
15
+
# nix-shell between each test, maybe even:
16
16
+
# $ nix-shell --run "make clean all"
17
17
+
# otherwise they won't reapply :)
18
18
+
HIGHLIGHTJS = pkgs.documentation-highlighter;
14
19
XSL = "${pkgs.docbook5_xsl}/xml/xsl";
15
20
RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng";
16
21
xsltFlags = lib.concatStringsSep " " [
17
22
"--param section.autolabel 1"
18
23
"--param section.label.includes.component.label 1"
19
19
-
"--stringparam html.stylesheet 'style.css overrides.css'"
24
24
+
"--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'"
25
25
+
"--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'"
20
26
"--param xref.with.number.and.title 1"
21
27
"--param toc.section.depth 3"
22
28
"--stringparam admon.style ''"
+1
-1
doc/style.css
reviewed
···
104
104
padding: 3px 3px;
105
105
margin-left: 1.5em;
106
106
margin-right: 1.5em;
107
107
-
color: #600000;
107
107
+
108
108
background: #f4f4f8;
109
109
font-family: monospace;
110
110
border-radius: 0.4em;