From 87b096c7f94045101bbe7887c2ce03a9b2e54e8b Mon Sep 17 00:00:00 2001 From: Jacob Bom Date: Wed, 7 Jun 2017 12:40:09 +0200 Subject: [PATCH] Only document functions/methods that are 100% lowercase + use favicon In bot.py we did stuff like sendAudio = send_audio, which made sphinx document both, which led to clutter in our docs. --- docs/source/conf.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d80714c0b..d967fb4c2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,6 @@ # # All configuration values have a default; values that are commented out # serve to show the default. - import sys import os import shlex @@ -25,7 +24,7 @@ sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +needs_sphinx = '1.5.4' # fixes issues with autodoc-skip-member and napoleon # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -136,7 +135,7 @@ html_logo = 'ptb-logo-orange.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = 'ptb-logo-orange.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -289,3 +288,18 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False + +# -- script stuff -------------------------------------------------------- + +import inspect + + +def autodoc_skip_member(app, what, name, obj, skip, options): + if inspect.getmodule(obj).__name__.startswith('telegram') and inspect.isfunction(obj): + if name.lower() != name: + return True + # Return None so napoleon can handle it + + +def setup(app): + app.connect('autodoc-skip-member', autodoc_skip_member)