Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5afb48364df9
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0d02468af7fa
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Mar 27, 2018

  1. nixpkgs docs: syntax highlight

    (cherry picked from commit 8dac5ce)
    grahamc committed Mar 27, 2018
    Copy the full SHA
    0d02468 View commit details
Showing with 30 additions and 5 deletions.
  1. +1 −0 doc/.gitignore
  2. +21 −3 doc/Makefile
  3. +7 −1 doc/default.nix
  4. +1 −1 doc/style.css
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@
.version
out
manual-full.xml
highlightjs
24 changes: 21 additions & 3 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -6,29 +6,40 @@ 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 \
--output $@ \
"$$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

8 changes: 7 additions & 1 deletion doc/default.nix
Original file line number Diff line number Diff line change
@@ -11,12 +11,18 @@ pkgs.stdenv.mkDerivation {

src = ./.;

# Hacking on these variables? Make sure to close and open
# nix-shell between each test, maybe even:
# $ nix-shell --run "make clean all"
# otherwise they won't reapply :)
HIGHLIGHTJS = pkgs.documentation-highlighter;
XSL = "${pkgs.docbook5_xsl}/xml/xsl";
RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng";
xsltFlags = lib.concatStringsSep " " [
"--param section.autolabel 1"
"--param section.label.includes.component.label 1"
"--stringparam html.stylesheet 'style.css overrides.css'"
"--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'"
"--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'"
"--param xref.with.number.and.title 1"
"--param toc.section.depth 3"
"--stringparam admon.style ''"
2 changes: 1 addition & 1 deletion doc/style.css
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ pre.screen, pre.programlisting
padding: 3px 3px;
margin-left: 1.5em;
margin-right: 1.5em;
color: #600000;

background: #f4f4f8;
font-family: monospace;
border-radius: 0.4em;