summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-04-05 08:38:43 -0400
committerGitHub <noreply@github.com>2018-04-05 08:38:43 -0400
commitbea1f22766c8835bae828f30ecd4663c7cafba6e (patch)
tree9445fc8c9f215448357015f5d8c5358bb971d4a1
parent59ddb3ebfbe43625a36d4863739280cedf88c404 (diff)
parent8f33464ca7a603301cf9a5a213be23ca701d6cce (diff)
downloadnixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar.gz
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar.bz2
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar.lz
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar.xz
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.tar.zst
nixpkgs-bea1f22766c8835bae828f30ecd4663c7cafba6e.zip
Merge pull request #38461 from grahamc/syntax-highlight-nixos-docs
nixos docs: syntax highlight
-rw-r--r--doc/Makefile8
-rw-r--r--doc/style.css17
-rw-r--r--nixos/doc/manual/default.nix13
-rw-r--r--nixos/doc/manual/style.css267
-rw-r--r--pkgs/misc/documentation-highlighter/loader.js7
5 files changed, 33 insertions, 279 deletions
diff --git a/doc/Makefile b/doc/Makefile
index c16e70e9c6a..0ddae8631f3 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -25,13 +25,6 @@ out/html/index.html: manual-full.xml style.css highlightjs
 		./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/
@@ -63,6 +56,7 @@ highlightjs:
 	cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/
 	cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/
 	cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/
+	cp -r "$$HIGHLIGHTJS/loader.js" highlightjs/
 
 
 manual-full.xml: ${MD_TARGETS} .version *.xml
diff --git a/doc/style.css b/doc/style.css
index 83dae0dd2cd..0db907815b6 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -248,6 +248,23 @@ table
     box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
 }
 
+table.simplelist
+{
+    text-align: left;
+    color: #005aa0;
+    border: 0;
+    padding: 5px;
+    background: #fffff5;
+    font-weight: normal;
+    font-style: italic;
+    box-shadow: none;
+    margin-bottom: 1em;
+}
+
+div.navheader table, div.navfooter table {
+    box-shadow: none;
+}
+
 div.affiliation
 {
     font-style: italic;
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index c51c30065a3..ac22712baf8 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -124,11 +124,12 @@ let
   manualXsltprocOptions = toString [
     "--param section.autolabel 1"
     "--param section.label.includes.component.label 1"
-    "--stringparam html.stylesheet style.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 ''"
-    "--stringparam callout.graphics.extension .gif"
+    "--stringparam callout.graphics.extension .svg"
     "--stringparam current.docid manual"
     "--param chunk.section.depth 0"
     "--param chunk.first.sections 1"
@@ -260,9 +261,11 @@ in rec {
         ${manual-combined}/manual-combined.xml
 
       mkdir -p $dst/images/callouts
-      cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
+      cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
 
-      cp ${./style.css} $dst/style.css
+      cp ${../../../doc/style.css} $dst/style.css
+      cp ${../../../doc/overrides.css} $dst/overrides.css
+      cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
 
       mkdir -p $out/nix-support
       echo "nix-build out $out" >> $out/nix-support/hydra-build-products
@@ -286,7 +289,7 @@ in rec {
         ${manual-combined}/manual-combined.xml
 
       mkdir -p $dst/epub/OEBPS/images/callouts
-      cp -r ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/epub/OEBPS/images/callouts # */
+      cp -r ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.svg $dst/epub/OEBPS/images/callouts # */
       echo "application/epub+zip" > mimetype
       manual="$dst/nixos-manual.epub"
       zip -0Xq "$manual" mimetype
diff --git a/nixos/doc/manual/style.css b/nixos/doc/manual/style.css
deleted file mode 100644
index 3118b37ead1..00000000000
--- a/nixos/doc/manual/style.css
+++ /dev/null
@@ -1,267 +0,0 @@
-/* Copied from http://bakefile.sourceforge.net/, which appears
-   licensed under the GNU GPL. */
-
-
-/***************************************************************************
-                             Basic headers and text:
- ***************************************************************************/
-
-body
-{
-    font-family: "Nimbus Sans L", sans-serif;
-    background: white;
-    margin: 2em 1em 2em 1em;
-}
-
-h1, h2, h3, h4
-{
-    color: #005aa0;
-}
-
-h1 /* title */
-{
-    font-size: 200%;
-}
-
-h2 /* chapters, appendices, subtitle */
-{
-    font-size: 180%;
-}
-
-/* Extra space between chapters, appendices. */
-div.chapter > div.titlepage h2, div.appendix > div.titlepage h2 
-{ 
-    margin-top: 1.5em;
-}
-
-div.section > div.titlepage h2 /* sections */
-{
-    font-size: 150%;
-    margin-top: 1.5em;
-}
-
-h3 /* subsections */
-{
-    font-size: 125%;
-}
-
-div.simplesect h2
-{
-    font-size: 110%;
-}
-
-div.appendix h3
-{
-    font-size: 150%;
-    margin-top: 1.5em;
-}
-
-div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
-{
-    margin-top: 1.4em;
-    font-size: 125%;
-}
-
-div.refsection h3
-{
-    font-size: 110%;
-}
-
-
-/***************************************************************************
-                               Examples:
- ***************************************************************************/
-
-div.example
-{
-    border: 1px solid #b0b0b0;
-    padding: 6px 6px;
-    margin-left: 1.5em;
-    margin-right: 1.5em;
-    background: #f4f4f8;
-    border-radius: 0.4em;
-    box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
-}
-
-div.example p.title
-{
-    margin-top: 0em;
-}
-
-div.example pre
-{
-    box-shadow: none;
-}
-
-
-/***************************************************************************
-                            Screen dumps:
- ***************************************************************************/
-
-pre.screen, pre.programlisting
-{
-    border: 1px solid #b0b0b0;
-    padding: 3px 3px;
-    margin-left: 1.5em;
-    margin-right: 1.5em;
-    color: #600000;
-    background: #f4f4f8;
-    font-family: monospace;
-    border-radius: 0.4em;
-    box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
-}
-
-div.example pre.programlisting
-{
-    border: 0px;
-    padding: 0 0;
-    margin: 0 0 0 0;
-}
-
-
-/***************************************************************************
-                               Notes, warnings etc:
- ***************************************************************************/
-
-.note, .warning
-{
-    border: 1px solid #b0b0b0;
-    padding: 3px 3px;
-    margin-left: 1.5em;
-    margin-right: 1.5em;
-    margin-bottom: 1em;
-    padding: 0.3em 0.3em 0.3em 0.3em;
-    background: #fffff5;
-    border-radius: 0.4em;
-    box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
-}
-
-div.note, div.warning
-{
-    font-style: italic;
-}
-
-div.note h3, div.warning h3
-{
-    color: red;
-    font-size: 100%;
-    padding-right: 0.5em;
-    display: inline;
-}
-
-div.note p, div.warning p
-{
-    margin-bottom: 0em;
-}
-
-div.note h3 + p, div.warning h3 + p
-{
-    display: inline;
-}
-
-div.note h3
-{
-    color: blue;
-    font-size: 100%;
-}
-
-div.navfooter *
-{
-    font-size: 90%;
-}
-
-
-/***************************************************************************
-                        Links colors and highlighting: 
- ***************************************************************************/
-
-a { text-decoration: none; }
-a:hover { text-decoration: underline; }
-a:link { color: #0048b3; }
-a:visited { color: #002a6a; }
-
-
-/***************************************************************************
-                              Table of contents:
- ***************************************************************************/
-
-div.toc
-{
-    font-size: 90%;
-}
-
-div.toc dl
-{
-    margin-top: 0em;
-    margin-bottom: 0em;
-}
-
-
-/***************************************************************************
-                               Special elements:
- ***************************************************************************/
-
-tt, code
-{
-    color: #400000;
-}
-
-.term
-{
-    font-weight: bold;
-    
-}
-
-div.variablelist dd p, div.glosslist dd p
-{
-    margin-top: 0em;
-}
-
-div.variablelist dd, div.glosslist dd
-{
-    margin-left: 1.5em;
-}
-
-div.glosslist dt
-{
-    font-style: italic;
-}
-
-.varname
-{
-    color: #400000;
-}
-
-span.command strong
-{
-    font-weight: normal;
-    color: #400000;
-}
-
-div.calloutlist table
-{
-    box-shadow: none;
-}
-
-table
-{
-    border-collapse: collapse;
-    box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
-}
-
-table.simplelist
-{
-    text-align: left;
-    color: #005aa0;
-    border: 0;
-    padding: 5px;
-    background: #fffff5;
-    font-weight: normal;
-    font-style: italic;
-    box-shadow: none;
-    margin-bottom: 1em;
-}
-
-div.navheader table, div.navfooter table {
-    box-shadow: none;
-}
diff --git a/pkgs/misc/documentation-highlighter/loader.js b/pkgs/misc/documentation-highlighter/loader.js
new file mode 100644
index 00000000000..4ad7dbf24b5
--- /dev/null
+++ b/pkgs/misc/documentation-highlighter/loader.js
@@ -0,0 +1,7 @@
+/* This file is NOT part of highlight.js */
+document.onreadystatechange = function () {
+    var listings = document.querySelectorAll('.programlisting, .screen');
+    for (i = 0; i < listings.length; ++i) {
+        hljs.highlightBlock(listings[i]);
+    }
+}