nixpkgs/pkgs/tools/typesetting/asciidoctor/default.nix
Bjørn Forsman 8f13d3cada asciidoctor: add revealjs support
This allows creating HTML presentations with
`asciidoctor-revealjs presentation.adoc`.

NOTE: The generated HTML file implicitly depend on reveal.js (and I see
no good way to bundle it with Nix). Either provide reveal.js in a local
path next to the generated HTML file[1], or override the revealjsdir
attribute, for example by pointing to an URL (can also be a path):

  asciidoctor-revealjs -a revealjsdir=https://cdn.jsdelivr.net/npm/reveal.js@3.9.2 presentation.adoc

Implementation details:
1. Added "gem 'asciidoctor-revealjs'" to the Gemfile.
2. Ran "nix-shell -p bundler --run 'bundle lock --update'"
   from pkgs/tools/typesetting/asciidoctor/.
3. Hand edited Gemfile.lock to remove all but the asciidoctor-revealjs
   changes. (Rationale: allow backporting to release-20.09.)
4. Finish off with "nix-shell -p bundix --run 'bundix'".

[1] Of course Nix can help with _that_, but that's external to the
asciidoctor-revealjs program.
2020-12-05 15:20:35 +01:00

41 lines
987 B
Nix

{ lib, bundlerApp, makeWrapper,
# Optional dependencies, can be null
epubcheck, kindlegen,
bundlerUpdateScript
}:
let
app = bundlerApp {
pname = "asciidoctor";
gemdir = ./.;
exes = [
"asciidoctor"
"asciidoctor-pdf"
"asciidoctor-epub3"
"asciidoctor-revealjs"
];
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram "$out/bin/asciidoctor-epub3" \
${lib.optionalString (epubcheck != null) "--set EPUBCHECK ${epubcheck}/bin/epubcheck"} \
${lib.optionalString (kindlegen != null) "--set KINDLEGEN ${kindlegen}/bin/kindlegen"}
'';
passthru = {
updateScript = bundlerUpdateScript "asciidoctor";
};
meta = with lib; {
description = "A faster Asciidoc processor written in Ruby";
homepage = "https://asciidoctor.org/";
license = licenses.mit;
maintainers = with maintainers; [ gpyh nicknovitski ];
platforms = platforms.unix;
};
};
in
app