lol

nixos/make-options-doc: link manpages

Add links to manpages without a link using the mapping defined in
`doc/manpage-urls.json`, as is already done for the nixpkgs and NixOS
manuals.

+11 -1
+2
nixos/lib/make-options-doc/default.nix
··· 130 130 if baseOptionsJSON == null 131 131 then builtins.toFile "base.json" "{}" 132 132 else baseOptionsJSON; 133 + 134 + MANPAGE_URLS = pkgs.path + "/doc/manpage-urls.json"; 133 135 } 134 136 '' 135 137 # Export list of options in different format.
+9 -1
nixos/lib/make-options-doc/mergeJSON.py
··· 1 1 import collections 2 2 import json 3 + import os 3 4 import sys 4 5 from typing import Any, Dict, List 5 6 ··· 45 46 ) 46 47 result[opt.name] = opt.value 47 48 return result 49 + 50 + manpage_urls = json.load(open(os.getenv('MANPAGE_URLS'))) 48 51 49 52 admonitions = { 50 53 '.warning': 'warning', ··· 119 122 def env(self, text): 120 123 return f"<envar>{escape(text)}</envar>" 121 124 def manpage(self, page, section): 125 + man = f"{page}({section})" 122 126 title = f"<refentrytitle>{escape(page)}</refentrytitle>" 123 127 vol = f"<manvolnum>{escape(section)}</manvolnum>" 124 - return f"<citerefentry>{title}{vol}</citerefentry>" 128 + ref = f"<citerefentry>{title}{vol}</citerefentry>" 129 + if man in manpage_urls: 130 + return self.link(manpage_urls[man], text=ref) 131 + else: 132 + return ref 125 133 126 134 def finalize(self, data): 127 135 return "".join(data)