From abc6cc7ac68e70e2ff62d5bf158ef00c3ce97006 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 23 Nov 2013 21:39:18 +0100 Subject: [PATCH 1/3] mpd: Format multiline patterns properly in docs (cherry picked from commit e2b36cb0f0702f44a25fcec79cca8dd3b3bded43) --- mopidy/frontends/mpd/protocol/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/mpd/protocol/__init__.py b/mopidy/frontends/mpd/protocol/__init__.py index dbb96a1b..0c2e5b25 100644 --- a/mopidy/frontends/mpd/protocol/__init__.py +++ b/mopidy/frontends/mpd/protocol/__init__.py @@ -15,6 +15,8 @@ from __future__ import unicode_literals from collections import namedtuple import re +from mopidy.utils import formatting + #: The MPD protocol uses UTF-8 for encoding all data. ENCODING = 'UTF-8' @@ -66,8 +68,8 @@ def handle_request(pattern, auth_required=True): raise ValueError('Tried to redefine handler for %s with %s' % ( pattern, func)) request_handlers[compiled_pattern] = func - func.__doc__ = ' - *Pattern:* ``%s``\n\n%s' % ( - pattern, func.__doc__ or '') + func.__doc__ = '*Pattern:*\n\n.. code-block:: text\n\n%s\n\n%s' % ( + formatting.indent(pattern, places=4), func.__doc__ or '') return func return decorator From 55afa18672972822758d2d8ea46423ddce1170a7 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 23 Nov 2013 21:40:05 +0100 Subject: [PATCH 2/3] docs: Fix reference (cherry picked from commit 13fb2bf6048b1045d18ce708b9463585daf536de) --- docs/extensiondev.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 38fe1c55..7fa19f7a 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -386,8 +386,8 @@ such as scanning for media, adding a command is the way to go. Your top level command name will always match your extension name, but you are free to add sub-commands with names of your choosing. -The skeleton of a commands would look like this. See :ref:`command-api` for more -details. +The skeleton of a commands would look like this. See :ref:`commands-api` for +more details. :: From 54caa95fb49b5253acf112e56d8ef5e8a52dcf37 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 23 Nov 2013 21:47:11 +0100 Subject: [PATCH 3/3] mpd: Format multiline patterns properly, second try (cherry picked from commit f383e9ad4825d9d38de92eb2ddf207d97af62c43) --- mopidy/frontends/mpd/protocol/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/mpd/protocol/__init__.py b/mopidy/frontends/mpd/protocol/__init__.py index 0c2e5b25..8a0993d8 100644 --- a/mopidy/frontends/mpd/protocol/__init__.py +++ b/mopidy/frontends/mpd/protocol/__init__.py @@ -68,8 +68,18 @@ def handle_request(pattern, auth_required=True): raise ValueError('Tried to redefine handler for %s with %s' % ( pattern, func)) request_handlers[compiled_pattern] = func - func.__doc__ = '*Pattern:*\n\n.. code-block:: text\n\n%s\n\n%s' % ( - formatting.indent(pattern, places=4), func.__doc__ or '') + func.__doc__ = """ + *Pattern:* + + .. code-block:: text + +%(pattern)s + +%(docs)s + """ % { + 'pattern': formatting.indent(pattern, places=8, singles=True), + 'docs': func.__doc__ or '', + } return func return decorator