docsets.python3-std: remove a lot of noise from the python docs

This commit is contained in:
2024-11-05 05:44:50 +00:00
parent 50277ff3bc
commit e307c5a60c
2 changed files with 12 additions and 1 deletions

View File

@@ -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

View File

@@ -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)