From a118a9897045104c8bacae315bcec68ef7ccedfa Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Mon, 23 Sep 2013 22:48:16 +0200 Subject: asciidoc: add odf backend, for OpenDocument output See https://github.com/dagwieers/asciidoc-odf for more info. This plugin has a shebang with /bin/env instead of /usr/bin/env, so update the patchPhase to handle both cases. WARNING/TODO: Libreoffice says "General Error. General input/output error." when I try to open the generated .fodp files. So the odt backend works fine, but the odp backend does not. --- pkgs/tools/typesetting/asciidoc/default.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'pkgs/tools') diff --git a/pkgs/tools/typesetting/asciidoc/default.nix b/pkgs/tools/typesetting/asciidoc/default.nix index 9b5d57f7bfd2..3da510550430 100644 --- a/pkgs/tools/typesetting/asciidoc/default.nix +++ b/pkgs/tools/typesetting/asciidoc/default.nix @@ -9,6 +9,7 @@ , enableAafigureFilter ? false, aafigure ? null, recursivePthLoader ? null # backends , enableDeckjsBackend ? false +, enableOdfBackend ? false }: # filters @@ -19,7 +20,7 @@ assert enableDiagFilter -> blockdiag != null && seqdiag != null && actdiag != nu assert enableMatplotlibFilter -> matplotlib != null && numpy != null; assert enableAafigureFilter -> aafigure != null && recursivePthLoader != null; # backends -assert enableDeckjsBackend -> unzip != null; +assert (enableDeckjsBackend || enableOdfBackend) -> unzip != null; let @@ -69,6 +70,16 @@ let sha256 = "1siy1j8naj5irrrrv5bfgl4d8nal6j9pyahy4f50wmrr9wv59s46"; }; + # the odf backend is actually two plugins: odt + odp + odtBackendSrc = fetchurl { + url = "https://github.com/downloads/dagwieers/asciidoc-odf/odt-backend-0.1.zip"; + sha256 = "1zaa97h9sx6ncxcdkl1x3ggydi7f8kjgvrnpjnkjiizi45k350kw"; + }; + odpBackendSrc = fetchurl { + url = "https://github.com/downloads/dagwieers/asciidoc-odf/odp-backend-0.1.zip"; + sha256 = "08ya4bskygzqkfqwjllpg31qc5k08xp2k78z9b2480g8y57bfy10"; + }; + in stdenv.mkDerivation rec { @@ -130,9 +141,17 @@ stdenv.mkDerivation rec { '' + optionalString enableDeckjsBackend '' echo "Extracting deckjs backend" unzip -d "$out/etc/asciidoc/backends/deckjs" "${deckjsBackendSrc}" + '' + optionalString enableOdfBackend '' + echo "Extracting odf backend (odt + odp)" + unzip -d "$out/etc/asciidoc/backends/odt" "${odtBackendSrc}" + unzip -d "$out/etc/asciidoc/backends/odp" "${odpBackendSrc}" + # The odt backend has a TODO note about removing this hardcoded path, but + # the odp backend already has that fix. Copy it here until fixed upstream. + sed -i "s|'/etc/asciidoc/backends/odt/asciidoc.ott'|os.path.dirname(__file__),'asciidoc.ott'|" \ + "$out/etc/asciidoc/backends/odt/a2x-backend.py" '' + '' for n in $(find "$out" . -name \*.py); do - sed -i -e "s,^#![[:space:]]*/usr/bin/env python,#!${python}/bin/python,g" "$n" + sed -i -e "s,^#![[:space:]]*.*/bin/env python,#!${python}/bin/python,g" "$n" chmod +x "$n" done sed -i -e "s,/etc/vim,,g" Makefile.in -- cgit 1.4.1