Closes #1198: Allow "image" for the "figwidth" option of the :rst:dir:figure directive as documented by docutils.

This commit is contained in:
Georg Brandl 2014-01-12 19:28:47 +01:00
parent 12b3b49f22
commit 531d70989f
2 changed files with 3 additions and 10 deletions

View File

@ -69,6 +69,9 @@ Bugs fixed
* #1233: Allow finding both Python classes and exceptions with the "class" and * #1233: Allow finding both Python classes and exceptions with the "class" and
"exc" roles in intersphinx. "exc" roles in intersphinx.
* #1198: Allow "image" for the "figwidth" option of the :rst:dir:`figure`
directive as documented by docutils.
Documentation Documentation
------------- -------------

View File

@ -12,7 +12,6 @@
import re import re
from docutils.parsers.rst import Directive, directives from docutils.parsers.rst import Directive, directives
from docutils.parsers.rst.directives import images
from sphinx import addnodes from sphinx import addnodes
from sphinx.util.docfields import DocFieldTransformer from sphinx.util.docfields import DocFieldTransformer
@ -22,15 +21,6 @@ from sphinx.directives.code import *
from sphinx.directives.other import * from sphinx.directives.other import *
# allow units for the figure's "figwidth"
try:
images.Figure.option_spec['figwidth'] = \
directives.length_or_percentage_or_unitless
except AttributeError:
images.figure.options['figwidth'] = \
directives.length_or_percentage_or_unitless
# RE to strip backslash escapes # RE to strip backslash escapes
nl_escape_re = re.compile(r'\\\n') nl_escape_re = re.compile(r'\\\n')
strip_backslash_re = re.compile(r'\\(.)') strip_backslash_re = re.compile(r'\\(.)')