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