at 22.05-pre 719 B view raw
1--[[ 2Turns a manpage reference into a link, when a mapping is defined 3in the unix-man-urls.lua file. 4]] 5 6local man_urls = { 7 ["tmpfiles.d(5)"] = "https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html", 8 ["nix.conf(5)"] = "https://nixos.org/manual/nix/stable/#sec-conf-file", 9 ["systemd.time(7)"] = "https://www.freedesktop.org/software/systemd/man/systemd.time.html", 10 ["systemd.timer(5)"] = "https://www.freedesktop.org/software/systemd/man/systemd.timer.html", 11} 12 13function Code(elem) 14 local is_man_role = elem.classes:includes('interpreted-text') and elem.attributes['role'] == 'manpage' 15 if is_man_role and man_urls[elem.text] ~= nil then 16 return pandoc.Link(elem, man_urls[elem.text]) 17 end 18end