mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add image_converter_args confval
This commit is contained in:
parent
c525723807
commit
2b9b4f92a5
@ -23,3 +23,8 @@ Configuration
|
||||
|
||||
A path to :command:`convert` command. By default, the imgconverter uses
|
||||
the command from search paths.
|
||||
|
||||
.. confval:: image_converter_args
|
||||
|
||||
Additional command-line arguments to give to :command:`convert`, as a list.
|
||||
The default is an empty list ``[]``.
|
||||
|
@ -51,8 +51,10 @@ class ImagemagickConverter(ImageConverter):
|
||||
# type: (unicode, unicode) -> None
|
||||
"""Converts the image to expected one."""
|
||||
try:
|
||||
p = subprocess.Popen([self.config.image_converter, _from, _to],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
args = ([self.config.image_converter] +
|
||||
self.config.image_converter_args +
|
||||
[_from, _to])
|
||||
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
except OSError as err:
|
||||
if err.errno != ENOENT: # No such file or directory
|
||||
raise
|
||||
@ -80,6 +82,7 @@ def setup(app):
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.add_post_transform(ImagemagickConverter)
|
||||
app.add_config_value('image_converter', 'convert', 'env')
|
||||
app.add_config_value('image_converter_args', [], 'env')
|
||||
|
||||
return {
|
||||
'version': 'builtin',
|
||||
|
Loading…
Reference in New Issue
Block a user