Fix #4720: message when an image is mismatched for builder is not clear

This commit is contained in:
Takeshi KOMIYA
2018-03-17 14:37:50 +09:00
parent d97f41c0e3
commit 39835bf885
5 changed files with 14 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ Bugs fixed
* #4725: Sphinx does not work with python 3.5.0 and 3.5.1
* #4716: Generation PDF file with TexLive on Windows, file not found error
* #4574: vertical space before equation in latex
* #4720: message when an image is mismatched for builder is not clear
Testing
--------

View File

@@ -211,9 +211,14 @@ class Builder(object):
if candidate:
break
else:
logger.warning('no matching candidate for image URI %r',
images.get_original_image_uri(node['uri']),
location=node)
mimetypes = sorted(node['candidates'])
image_uri = images.get_original_image_uri(node['uri'])
if mimetypes:
logger.warning('a suitable image for %s builder not found: %s (%s)',
self.name, mimetypes, image_uri, location=node)
else:
logger.warning('a suitable image for %s builder not found: %s',
self.name, image_uri, location=node)
continue
node['uri'] = candidate
else:

View File

@@ -40,7 +40,7 @@ with "\\?": b?'here: >>>(\\\\|/)xbb<<<((\\\\|/)r)?'
HTML_WARNINGS = ENV_WARNINGS + """\
%(root)s/index.rst:\\d+: WARNING: unknown option: &option
%(root)s/index.rst:\\d+: WARNING: citation not found: missing
%(root)s/index.rst:\\d+: WARNING: no matching candidate for image URI u'foo.\\*'
%(root)s/index.rst:\\d+: WARNING: a suitable image for html builder not found: foo.\\*
%(root)s/index.rst:\\d+: WARNING: Could not lex literal_block as "c". Highlighting skipped.
"""

View File

@@ -36,7 +36,7 @@ STYLEFILES = ['article.cls', 'fancyhdr.sty', 'titlesec.sty', 'amsmath.sty',
LATEX_WARNINGS = ENV_WARNINGS + """\
%(root)s/index.rst:\\d+: WARNING: unknown option: &option
%(root)s/index.rst:\\d+: WARNING: citation not found: missing
%(root)s/index.rst:\\d+: WARNING: no matching candidate for image URI u'foo.\\*'
%(root)s/index.rst:\\d+: WARNING: a suitable image for latex builder not found: foo.\\*
%(root)s/index.rst:\\d+: WARNING: Could not lex literal_block as "c". Highlighting skipped.
"""

View File

@@ -25,8 +25,9 @@ from sphinx.writers.texinfo import TexinfoTranslator
TEXINFO_WARNINGS = ENV_WARNINGS + """\
%(root)s/index.rst:\\d+: WARNING: unknown option: &option
%(root)s/index.rst:\\d+: WARNING: citation not found: missing
%(root)s/index.rst:\\d+: WARNING: no matching candidate for image URI u'foo.\\*'
%(root)s/index.rst:\\d+: WARNING: no matching candidate for image URI u'svgimg.\\*'
%(root)s/index.rst:\\d+: WARNING: a suitable image for texinfo builder not found: foo.\\*
%(root)s/index.rst:\\d+: WARNING: a suitable image for texinfo builder not found: \
\\['application/pdf', 'image/svg\\+xml'\\] \\(svgimg.\\*\\)
"""
if PY3: