From 09544fc5f89208eea755245b64cb3c9b79f3b687 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 12 Jan 2014 19:48:37 +0100 Subject: [PATCH 1/2] Closes #1093: use max-width: 100% for images in basic/epub theme --- sphinx/themes/basic/static/basic.css_t | 1 + sphinx/themes/epub/static/epub.css | 1 + 2 files changed, 2 insertions(+) diff --git a/sphinx/themes/basic/static/basic.css_t b/sphinx/themes/basic/static/basic.css_t index 83af2303a..d54e7f4ec 100644 --- a/sphinx/themes/basic/static/basic.css_t +++ b/sphinx/themes/basic/static/basic.css_t @@ -89,6 +89,7 @@ div.sphinxsidebar #searchbox input[type="submit"] { img { border: 0; + max-width: 100%; } /* -- search page ----------------------------------------------------------- */ diff --git a/sphinx/themes/epub/static/epub.css b/sphinx/themes/epub/static/epub.css index 5e5f07c13..3f4664f6d 100644 --- a/sphinx/themes/epub/static/epub.css +++ b/sphinx/themes/epub/static/epub.css @@ -92,6 +92,7 @@ div.sphinxsidebar input { img { border: 0; + max-width: 100%; } /* -- search page ----------------------------------------------------------- */ From f2d8d2abbb0b9be05126df8fee17264b2f456591 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 12 Jan 2014 19:58:31 +0100 Subject: [PATCH 2/2] Closes #1017: Be helpful and tell the user when the argument to :rst:dir:`option` does not match the required format. --- CHANGES | 3 +++ sphinx/domains/std.py | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 294e6580b..4379871aa 100644 --- a/CHANGES +++ b/CHANGES @@ -76,6 +76,9 @@ Bugs fixed versions for Python 2 and 3, and loading the appropriate version for the running Python version. +* #1017: Be helpful and tell the user when the argument to :rst:dir:`option` + does not match the required format. + Documentation ------------- diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index d5c92387d..895e35e56 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -27,8 +27,7 @@ from sphinx.util.compat import Directive # RE for option descriptions -option_desc_re = re.compile( - r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') +option_desc_re = re.compile(r'((?:/|-|--)[-_a-zA-Z0-9]+)(\s*.*)') class GenericObject(ObjectDescription): @@ -130,14 +129,23 @@ class Target(Directive): class Cmdoption(ObjectDescription): """ - Description of a command-line option (.. cmdoption). + Description of a command-line option (.. option). """ def handle_signature(self, sig, signode): """Transform an option description into RST nodes.""" count = 0 firstname = '' - for m in option_desc_re.finditer(sig): + for potential_option in sig.split(', '): + potential_option = potential_option.strip() + m = option_desc_re.match(potential_option) + if not m: + self.env.warn( + self.env.docname, + 'Malformed option description %r, should ' + 'look like "-opt args", "--opt args" or ' + '"/opt args"' % potential_option, self.lineno) + continue optname, args = m.groups() if count: signode += addnodes.desc_addname(', ', ', ')