|
103 | 103 | [(suffix, dpi), suffix, ...] |
104 | 104 |
|
105 | 105 | that determine the file format and the DPI. For entries whose |
106 | | - DPI was omitted, sensible defaults are chosen. |
| 106 | + DPI was omitted, sensible defaults are chosen. When passing from |
| 107 | + the command line through sphinx_build the list should be passed as |
| 108 | + suffix:dpi,suffix:dpi, .... |
107 | 109 |
|
108 | 110 | plot_html_show_formats |
109 | 111 | Whether to show links to the files in HTML. |
@@ -539,10 +541,17 @@ def render_figures(code, code_path, output_dir, output_base, context, |
539 | 541 | formats = [] |
540 | 542 | plot_formats = config.plot_formats |
541 | 543 | if isinstance(plot_formats, six.string_types): |
542 | | - plot_formats = eval(plot_formats) |
| 544 | + # String Sphinx < 1.3, Split on , to mimic |
| 545 | + # Sphinx 1.3 and later. Sphinx 1.3 always |
| 546 | + # returns a list. |
| 547 | + plot_formats = plot_formats.split(',') |
543 | 548 | for fmt in plot_formats: |
544 | 549 | if isinstance(fmt, six.string_types): |
545 | | - formats.append((fmt, default_dpi.get(fmt, 80))) |
| 550 | + if ':' in fmt: |
| 551 | + suffix,dpi = fmt.split(':') |
| 552 | + formats.append((str(suffix), int(dpi))) |
| 553 | + else: |
| 554 | + formats.append((fmt, default_dpi.get(fmt, 80))) |
546 | 555 | elif type(fmt) in (tuple, list) and len(fmt)==2: |
547 | 556 | formats.append((str(fmt[0]), int(fmt[1]))) |
548 | 557 | else: |
|
0 commit comments