From 489769f7c4d7285aa68145d07f77e208045f0235 Mon Sep 17 00:00:00 2001 From: Aaron VerDow Date: Fri, 14 Feb 2025 10:58:18 -0600 Subject: [PATCH] pandoc-mustache: init at 0.1.0 --- pkgs/by-name/pa/pandoc-mustache/package.nix | 47 +++++++++++++++++++ .../pa/pandoc-mustache/tests/default.nix | 30 ++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 pkgs/by-name/pa/pandoc-mustache/package.nix create mode 100644 pkgs/by-name/pa/pandoc-mustache/tests/default.nix diff --git a/pkgs/by-name/pa/pandoc-mustache/package.nix b/pkgs/by-name/pa/pandoc-mustache/package.nix new file mode 100644 index 000000000000..35d274b74963 --- /dev/null +++ b/pkgs/by-name/pa/pandoc-mustache/package.nix @@ -0,0 +1,47 @@ +{ + python3Packages, + fetchFromGitHub, + nix-update-script, + callPackage, + lib, +}: + +python3Packages.buildPythonApplication rec { + pname = "pandoc-mustache"; + version = "0.1.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "michaelstepner"; + repo = "pandoc-mustache"; + tag = "${version}"; + hash = "sha256-lgbQV4X2N4VuIEtjeSA542yqGdIs5QQ7+bdCoy/aloE="; + }; + + build-system = with python3Packages; [ + setuptools + pyparsing + ]; + + dependencies = with python3Packages; [ + panflute + pystache + pyyaml + future + ]; + + passthru = { + updateScript = nix-update-script { }; + tests = callPackage ./tests { }; + }; + + meta = { + description = "Pandoc Mustache Filter"; + homepage = "https://github.com/michaelstepner/pandoc-mustache"; + changelog = "https://github.com/michaelstepner/pandoc-mustache/releases/tag/${version}/CHANGELOG.md"; + maintainers = with lib.maintainers; [ averdow ]; + license = with lib.licenses; [ + cc-by-10 + ]; + }; +} diff --git a/pkgs/by-name/pa/pandoc-mustache/tests/default.nix b/pkgs/by-name/pa/pandoc-mustache/tests/default.nix new file mode 100644 index 000000000000..58db27cbd831 --- /dev/null +++ b/pkgs/by-name/pa/pandoc-mustache/tests/default.nix @@ -0,0 +1,30 @@ +{ + pkgs, + pandoc-mustache, + runCommand, +}: +let + vars = pkgs.writeText "vars.yaml" '' + place: Montreal + temperature: '7' + ''; + markdown = pkgs.writeText "markdown.md" '' + --- + title: My Report + author: Jane Smith + mustache: ${vars} + --- + The temperature in {{place}} was {{temperature}} degrees. + ''; +in +runCommand "pandoc-mustache-test" + { + nativeBuildInputs = [ + pandoc-mustache + pkgs.pandoc + ]; + } + '' + pandoc --filter pandoc-mustache ${markdown} --to plain | grep 'The temperature in Montreal was 7 degrees.' || exit 1 + touch $out + ''