python312Packages.lightning-utilities: 0.11.9 -> 0.12.0 (#378243)
[NixPkgs.git] / pkgs / tools / misc / pandoc-acro / default.nix
blob429d870cbb3e1dbe6b3a1e3235286c1c87d3be36
2   buildPythonApplication,
3   fetchPypi,
4   pandocfilters,
5   panflute,
6   lib,
7   pandoc,
8   pandoc-acro,
9   texliveTeTeX,
10   runCommand,
13 let
14   pname = "pandoc-acro";
15   version = "0.10.1";
17   src = fetchPypi {
18     inherit pname version;
19     hash = "sha256-JMfSQXX+BCGdFQYPFB+r08WRnhT3aXfnBNINROxCUA0=";
20   };
22 buildPythonApplication {
23   inherit pname version src;
25   propagatedBuildInputs = [
26     pandocfilters
27     panflute
28   ];
30   # Something in the tests does not typecheck, but the tool works well.
31   doCheck = false;
33   passthru.tests.example-doc =
34     let
35       env = {
36         nativeBuildInputs = [
37           pandoc
38           pandoc-acro
39           (texliveTeTeX.withPackages (
40             ps: with ps; [
41               acro
42               translations
43             ]
44           ))
45         ];
46       };
47     in
48     runCommand "pandoc-acro-example-docs" env ''
49       set -euo pipefail
50       exampleFile="${pname}-${version}/tests/example.md"
51       metadataFile="${pname}-${version}/tests/metadata.yaml"
52       tar --extract "--file=${src}" "$exampleFile" "$metadataFile"
53       mkdir $out
55       pandoc -F pandoc-acro "$exampleFile" "--metadata-file=$metadataFile" \
56         -T pdf -o $out/example.pdf
57       pandoc -F pandoc-acro  "$exampleFile" "--metadata-file=$metadataFile" \
58         -T txt -o $out/example.txt
60       ! grep -q "\+afaik" $out/example.txt
61     '';
63   meta = with lib; {
64     homepage = "https://pypi.org/project/pandoc-acro/";
65     description = "Pandoc filter which manages acronyms in Pandoc flavored Markdown sources";
66     license = licenses.bsd2;
67     maintainers = with maintainers; [ tfc ];
68     mainProgram = "pandoc-acro";
69   };