feat(nix/renderMarkdown): add optional tagfilter argument

Makes it possible to disable tag filtering for rendered content (on by
default, of course).

Change-Id: I74ecfee97eaa7abf32049172b28705e7a3f21548
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9276
Tested-by: BuildkiteCI
Reviewed-by: Mark Shevchenko <markshevchenko@gmail.com>
This commit is contained in:
Vincent Ambo 2023-09-08 15:49:38 +03:00 committed by tazjin
parent 87d63e4a1b
commit c5770e65dd

View file

@ -3,6 +3,19 @@
with depot.nix.yants;
defun [ path drv ] (file: pkgs.runCommand "${file}.rendered.html" { } ''
cat ${file} | ${depot.tools.cheddar}/bin/cheddar --about-filter ${file} > $out
'')
let
args = struct "args" {
path = path;
tagfilter = option bool;
};
in
defun [ (either path args) drv ]
(arg: pkgs.runCommand "${arg.path or arg}.rendered.html" { }
(
let
tagfilter = if (arg.tagfilter or true) then "" else "--no-tagfilter";
in
''
cat ${arg.path or arg} | ${depot.tools.cheddar}/bin/cheddar --about-filter ${tagfilter} ${arg.path or arg} > $out
''
))