summary refs log tree commit diff
path: root/doc/default.nix
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2023-01-02 14:00:58 +0100
committerNaïm Favier <n@monade.li>2023-01-02 14:11:22 +0100
commita8d4cf149cda4f82145291cc9a6819a9baa3951e (patch)
treea92d5a3a9c5bff6a5969561910113d9f8f88e6b6 /doc/default.nix
parent5a9a3353342fc2a964c58f91ef8cbb19585c3af8 (diff)
doc: separate manpage URLs from the Pandoc filter
Move the manpage-to-URL mapping to `doc/manpage-urls.json` so that we can
reuse that file elsewhere, and generate the `link-manpages.lua` filter from
that file.

Also modify the Pandoc filter so that it doesn't wrap manpages that are
already inside a link.

Keeping a Lua filter is essential for speed: a Python filter would
increase the runtime `md-to-db.sh` from ~20s to ~30s (but Python is not
to blame; marshalling Pandoc types to and from JSON is a costly operation).
Parsing in Lua seems tedious, so I went with the Nix way.
Diffstat (limited to 'doc/default.nix')
-rw-r--r--doc/default.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/default.nix b/doc/default.nix
index ac382ec8519c5..1d5fa4811a369 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -36,4 +36,5 @@ in pkgs.stdenv.mkDerivation {
 
   # Environment variables
   PANDOC_LUA_FILTERS_DIR = "${pkgs.pandoc-lua-filters}/share/pandoc/filters";
+  PANDOC_LINK_MANPAGES_FILTER = import build-aux/pandoc-filters/link-manpages.nix { inherit pkgs; };
 }