summary refs log tree commit diff
path: root/doc/default.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-09-30 17:21:08 +0200
committerPeter Simons <simons@cryp.to>2015-09-30 17:24:28 +0200
commita7840a9ce876680fab3302a5a3abf2624371cf0e (patch)
tree2b6d0aed150762f0d1a4d8f847b73277f60e8c07 /doc/default.nix
parent46f59a3a14dd32b873205a817420c68cfbe7f41c (diff)
downloadnixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar.gz
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar.bz2
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar.lz
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar.xz
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.tar.zst
nixpkgs-a7840a9ce876680fab3302a5a3abf2624371cf0e.zip
doc: generate haskell-users-guide.xml from Markdown input via Pandoc
Editing Docbook is no fun, IMHO, so I'd rather store the Haskell
documentation in Markdown format and use Pandoc to convert that into
Docbook as part of the build process.
Diffstat (limited to 'doc/default.nix')
-rw-r--r--doc/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/default.nix b/doc/default.nix
index 004ffb70b74..b8dac00eb65 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation {
 
   sources = sourceFilesBySuffices ./. [".xml"];
 
-  buildInputs = [ libxml2 libxslt ];
+  buildInputs = [ pandoc libxml2 libxslt ];
 
   xsltFlags = ''
     --param section.autolabel 1
@@ -19,6 +19,22 @@ stdenv.mkDerivation {
   '';
 
   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
+
     ln -s "$sources/"*.xml .
 
     echo ${nixpkgsVersion} > .version