about summary refs log tree commit diff
path: root/doc/build-aux
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-07-12 18:40:33 +0200
committerJan Tojnar <jtojnar@gmail.com>2021-07-13 02:21:22 +0200
commit04b59b0328daaa2e11f5e387ad3ec475cf2d2028 (patch)
treec93741cf282e772100da2d366a23cfd099a04da5 /doc/build-aux
parentc9139dfa1a001e32baa6fea9c9373d80c83e39e9 (diff)
downloadnixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar.gz
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar.bz2
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar.lz
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar.xz
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.tar.zst
nixlib-04b59b0328daaa2e11f5e387ad3ec475cf2d2028.zip
doc: Linkify man page references
Diffstat (limited to 'doc/build-aux')
-rw-r--r--doc/build-aux/pandoc-filters/link-unix-man-references.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/build-aux/pandoc-filters/link-unix-man-references.lua b/doc/build-aux/pandoc-filters/link-unix-man-references.lua
new file mode 100644
index 000000000000..12431f140fed
--- /dev/null
+++ b/doc/build-aux/pandoc-filters/link-unix-man-references.lua
@@ -0,0 +1,18 @@
+--[[
+Turns a manpage reference into a link, when a mapping is defined
+in the unix-man-urls.lua file.
+]]
+
+local man_urls = {
+  ["tmpfiles.d(5)"] = "https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html",
+  ["nix.conf(5)"] = "https://nixos.org/manual/nix/stable/#sec-conf-file",
+  ["systemd.time(7)"] = "https://www.freedesktop.org/software/systemd/man/systemd.time.html",
+  ["systemd.timer(5)"] = "https://www.freedesktop.org/software/systemd/man/systemd.timer.html",
+}
+
+function Code(elem)
+  local is_man_role = elem.classes:includes('interpreted-text') and elem.attributes['role'] == 'manpage'
+  if is_man_role and man_urls[elem.text] ~= nil then
+    return pandoc.Link(elem, man_urls[elem.text])
+  end
+end