jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676809 )
Change subject: [sphinx] Add fixup for Initializer ......................................................................
[sphinx] Add fixup for Initializer
Change-Id: I0260a96574affb4a49a31e7aaa9763ce3a7d2b6e --- M docs/conf.py 1 file changed, 11 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py index 7faaa7f..7b28b2d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -396,6 +396,15 @@ lines[:] = result[:] # assignment required in this way
+def pywikibot_docstring_fixups(app, what, name, obj, options, lines): + """Fixup docstrings.""" + if what != 'class': + return + + if lines and lines[0] == 'Initializer.': + lines[:] = lines[2:] + + def pywikibot_script_docstring_fixups(app, what, name, obj, options, lines): """Pywikibot specific conversions.""" from scripts.cosmetic_changes import warning @@ -408,9 +417,7 @@
length = 0 for index, line in enumerate(lines): - if line == 'Initializer.': - lines[index] = '' - elif line == '¶ms;': + if line == '¶ms;': lines[index] = ('This script supports use of ' ':py:mod:`pywikibot.pagegenerators` arguments.') elif name == 'scripts.replace' and line == '&fixes-help;': @@ -490,6 +497,7 @@ def setup(app): """Implicit Sphinx extension hook.""" app.connect('autodoc-process-docstring', pywikibot_epytext_to_sphinx) + app.connect('autodoc-process-docstring', pywikibot_docstring_fixups) app.connect('autodoc-process-docstring', pywikibot_script_docstring_fixups) app.connect('autodoc-skip-member', pywikibot_skip_members) app.add_autodoc_attrgetter(type, pywikibot_family_classproperty_getattr)