|
47 | 47 |
|
48 | 48 | The ``.. plot::`` directive supports the following options:
|
49 | 49 |
|
50 |
| -``:output-base-name:`` : str |
| 50 | +``:image-basename:`` : str |
51 | 51 | The base name (without the extension) of the outputted image files. The
|
52 | 52 | default is to use the same name as the input script, or the name of
|
53 |
| - the RST document if no script is provided. The output-base-name for each |
| 53 | + the RST document if no script is provided. The image-basename for each |
54 | 54 | plot directive must be unique.
|
55 | 55 |
|
56 | 56 | ``:format:`` : {'python', 'doctest'}
|
@@ -273,7 +273,7 @@ class PlotDirective(Directive):
|
273 | 273 | 'scale': directives.nonnegative_int,
|
274 | 274 | 'align': Image.align,
|
275 | 275 | 'class': directives.class_option,
|
276 |
| - 'output-base-name': directives.unchanged, |
| 276 | + 'image-basename': directives.unchanged, |
277 | 277 | 'include-source': _option_boolean,
|
278 | 278 | 'show-source-link': _option_boolean,
|
279 | 279 | 'format': _option_format,
|
@@ -642,16 +642,16 @@ def check_output_base_name(env, output_base):
|
642 | 642 |
|
643 | 643 | if '.' in output_base or '/' in output_base:
|
644 | 644 | raise PlotError(
|
645 |
| - f"The output-base-name '{output_base}' is invalid. " |
| 645 | + f"The image-basename '{output_base}' is invalid. " |
646 | 646 | f"It must not contain dots or slashes.")
|
647 | 647 |
|
648 | 648 | for d in env.mpl_custom_base_names:
|
649 | 649 | if output_base in env.mpl_custom_base_names[d]:
|
650 | 650 | if d == docname:
|
651 | 651 | raise PlotError(
|
652 |
| - f"The output-base-name " |
| 652 | + f"The image-basename " |
653 | 653 | f"{output_base}' is used multiple times.")
|
654 |
| - raise PlotError(f"The output-base-name " |
| 654 | + raise PlotError(f"The image-basename " |
655 | 655 | f"'{output_base}' is used multiple times "
|
656 | 656 | f"(it is also used in {env.doc2path(d)}).")
|
657 | 657 |
|
@@ -793,7 +793,7 @@ def run(arguments, content, options, state_machine, state, lineno):
|
793 | 793 |
|
794 | 794 | options.setdefault('include-source', config.plot_include_source)
|
795 | 795 | options.setdefault('show-source-link', config.plot_html_show_source_link)
|
796 |
| - options.setdefault('output-base-name', None) |
| 796 | + options.setdefault('image-basename', None) |
797 | 797 |
|
798 | 798 | if 'class' in options:
|
799 | 799 | # classes are parsed into a list of string, and output by simply
|
@@ -835,16 +835,16 @@ def run(arguments, content, options, state_machine, state, lineno):
|
835 | 835 | function_name = None
|
836 | 836 |
|
837 | 837 | code = Path(source_file_name).read_text(encoding='utf-8')
|
838 |
| - if options['output-base-name']: |
839 |
| - output_base = options['output-base-name'] |
| 838 | + if options['image-basename']: |
| 839 | + output_base = options['image-basename'] |
840 | 840 | check_output_base_name(env, output_base)
|
841 | 841 | else:
|
842 | 842 | output_base = os.path.basename(source_file_name)
|
843 | 843 | else:
|
844 | 844 | source_file_name = rst_file
|
845 | 845 | code = textwrap.dedent("\n".join(map(str, content)))
|
846 |
| - if options['output-base-name']: |
847 |
| - output_base = options['output-base-name'] |
| 846 | + if options['image-basename']: |
| 847 | + output_base = options['image-basename'] |
848 | 848 | check_output_base_name(env, output_base)
|
849 | 849 | else:
|
850 | 850 | base, ext = os.path.splitext(os.path.basename(source_file_name))
|
|
0 commit comments