diff --git a/pkgs/by-name/docsets/python3-std/package.nix b/pkgs/by-name/docsets/python3-std/package.nix index b3c1be993..3313105fc 100644 --- a/pkgs/by-name/docsets/python3-std/package.nix +++ b/pkgs/by-name/docsets/python3-std/package.nix @@ -11,7 +11,8 @@ runCommandLocal "docsets-python3-std" { cp -R ${python3.doc}/share/doc/* doc chmod -R u+w doc - doc2dash --index-page library/index.html doc/html + # `--parser ...` lets me inject my own module that doc2dash loads and delegates docset styling to + PYTHONPATH=${./.} doc2dash --parser sparse_sphinx_parser.InterSphinxParserLessNoise --index-page library/index.html doc/html mkdir -p $out/share/docsets cp -R *.docset $out/share/docsets diff --git a/pkgs/by-name/docsets/python3-std/sparse_sphinx_parser.py b/pkgs/by-name/docsets/python3-std/sparse_sphinx_parser.py new file mode 100644 index 000000000..69472efdd --- /dev/null +++ b/pkgs/by-name/docsets/python3-std/sparse_sphinx_parser.py @@ -0,0 +1,10 @@ +from doc2dash.parsers.intersphinx import InterSphinxParser +from doc2dash.parsers.types import EntryType + +class InterSphinxParserLessNoise(InterSphinxParser): + def convert_type(self, inv_type: str) -> EntryType | None: + # Sphinx is too noisy: we don't want page labels etc to drown out the actual API references + if inv_type.split(":")[-1] in [ "cmdoption", "doc", "envvar", "label", "macro", "opcode", "option", "term" ]: + return + + return super().convert_type(inv_type)