summary refs log tree commit diff
path: root/doc/default.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-12-21 10:50:37 +0100
committerVladimír Čunát <vcunat@gmail.com>2015-12-21 13:01:59 +0100
commit3e4035695c9c969675de66ca1b63e13ef57e5bd8 (patch)
treef82ff0fa8973666db1908360631c7e5cf7422161 /doc/default.nix
parent810695216ade42a83eef51a421115292d17be03e (diff)
downloadnixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar.gz
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar.bz2
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar.lz
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar.xz
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.tar.zst
nixpkgs-3e4035695c9c969675de66ca1b63e13ef57e5bd8.zip
nixpkgs manual: add idris docs generated from *.md
I also modified the nesting approach in haskell docs
to allow more uniform handling of markdown -> docbook conversions.
/cc #11308.
Diffstat (limited to 'doc/default.nix')
-rw-r--r--doc/default.nix46
1 files changed, 29 insertions, 17 deletions
diff --git a/doc/default.nix b/doc/default.nix
index cca68014b0d..7e41380d635 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -20,27 +20,39 @@ stdenv.mkDerivation {
     --param callout.graphics.extension '.gif'
   '';
 
-  buildCommand = ''
-    {
-      echo "<chapter xmlns=\"http://docbook.org/ns/docbook\""
-      echo "         xmlns:xlink=\"http://www.w3.org/1999/xlink\""
-      echo "         xml:id=\"users-guide-to-the-haskell-infrastructure\">"
-      echo ""
-      echo "<title>User's Guide to the Haskell Infrastructure</title>"
-      echo ""
-      pandoc ${./haskell-users-guide.md} -w docbook | \
-        sed -e 's|<ulink url=|<link xlink:href=|' \
-            -e 's|</ulink>|</link>|' \
-            -e 's|<sect. id=|<section xml:id=|' \
-            -e 's|</sect[0-9]>|</section>|'
-      echo ""
-      echo "</chapter>"
-    } >haskell-users-guide.xml
 
+  buildCommand = let toDocbook = { useChapters ? false, inputFile, outputFile }:
+    let
+      extraHeader = ''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
+    in ''
+      {
+        pandoc '${inputFile}' -w docbook ${optionalString useChapters "--chapters"} \
+          | sed -e 's|<ulink url=|<link xlink:href=|' \
+              -e 's|</ulink>|</link>|' \
+              -e 's|<sect. id=|<section xml:id=|' \
+              -e 's|</sect[0-9]>|</section>|' \
+              -e '1s| id=| xml:id=|' \
+              -e '1s|\(<[^ ]* \)|\1${extraHeader}|'
+      } > '${outputFile}'
+    '';
+  in
+
+  ''
     ln -s '${sources}/'*.xml .
     mkdir ./languages-frameworks
     cp -s '${sources-langs}'/* ./languages-frameworks
-
+  ''
+  + toDocbook {
+      inputFile = ./haskell-users-guide.md;
+      outputFile = "haskell-users-guide.xml";
+      useChapters = true;
+    }
+  + toDocbook {
+      inputFile = ./../pkgs/development/idris-modules/README.md;
+      outputFile = "languages-frameworks/idris.xml";
+    }
+  + ''
+    cat languages-frameworks/idris.xml
     echo ${nixpkgsVersion} > .version
 
     xmllint --noout --nonet --xinclude --noxincludenode \