pandoc-mustache: init at 0.1.0

This commit is contained in:
Aaron VerDow 2025-02-14 10:58:18 -06:00
parent 7f676a8e18
commit 489769f7c4
2 changed files with 77 additions and 0 deletions

View file

@ -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
];
};
}

View file

@ -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
''