Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c10b86

Browse files
committed
Fix doc style
1 parent 725f25d commit 2c10b86

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

doc/users/next_whats_new/2018_12_03_sphinx_plot_preserve.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ ReadTheDocs, you may wish to build imagery locally to avoid hitting resource
2424
limits on the server. Using the new changes allows extensive dynamically
2525
generated imagery to be used on services like ReadTheDocs.
2626

27-
The `:outname:` property
28-
~~~~~~~~~~~~~~~~~~~~~~~~
27+
The ``:outname:`` property
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~
2929

30-
These problems are addressed through two new features in the plot directive. The
31-
first is the introduction of the `:outname:` property. It is used like so:
30+
These problems are addressed through two new features in the plot directive.
31+
The first is the introduction of the ``:outname:`` property. It is used like
32+
so:
3233

3334
.. code-block:: rst
3435
@@ -41,20 +42,20 @@ first is the introduction of the `:outname:` property. It is used like so:
4142
img = mpimg.imread('_static/stinkbug.png')
4243
imgplot = plt.imshow(img)
4344
44-
Without `:outname:`, the figure generated above would normally be called, e.g.
45-
`docfile3-4-01.png` or something equally mysterious. With `:outname:` the figure
46-
generated will instead be named `stinkbug_plot-01.png` or even
47-
`stinkbug_plot.png`. This makes it easy to understand which output image is
48-
which and, more importantly, uniquely keys output images to code snippets.
45+
Without ``:outname:``, the figure generated above would normally be called,
46+
e.g. :file:`docfile3-4-01.png` or something equally mysterious. With
47+
``:outname:`` the figure generated will instead be named
48+
:file:`stinkbug_plot-01.png` or even :file:`stinkbug_plot.png`. This makes it
49+
easy to understand which output image is which and, more importantly, uniquely
50+
keys output images to code snippets.
4951

50-
The `plot_preserve_dir` configuration value
51-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
The ``plot_preserve_dir`` configuration value
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5254

53-
Setting the `plot_preserve_dir` configuration value to the name of a directory
54-
will cause all images with `:outname:` set to be copied to this directory upon
55-
generation.
55+
Setting the ``plot_preserve_dir`` configuration value to the name of a
56+
directory will cause all images with ``:outname:`` set to be copied to this
57+
directory upon generation.
5658

57-
If an image is already in `plot_preserve_dir` when documentation is being
59+
If an image is already in ``plot_preserve_dir`` when documentation is being
5860
generated, this image is copied to the build directory thereby pre-empting
5961
generation and reducing computation time in low-resource environments.
60-

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,11 @@ def run(arguments, content, options, state_machine, state, lineno):
672672
rst_file = document.attributes['source']
673673
rst_dir = os.path.dirname(rst_file)
674674

675-
#Get output name of the images, if the option was provided
675+
# Get output name of the images, if the option was provided
676676
outname = options.get('outname', '')
677677

678-
#Ensure that the outname is unique, otherwise copied images will
679-
#not be what user expects
678+
# Ensure that the outname is unique, otherwise copied images will
679+
# not be what user expects
680680
if outname and outname in _outname_list:
681681
raise Exception("The outname '{0}' is not unique!".format(outname))
682682
else:
@@ -722,8 +722,8 @@ def run(arguments, content, options, state_machine, state, lineno):
722722
else:
723723
source_ext = ''
724724

725-
#outname, if present, overrides output_base, but preserve
726-
#numbering of multi-figure code snippets
725+
# outname, if present, overrides output_base, but preserve
726+
# numbering of multi-figure code snippets
727727
if outname:
728728
output_base = re.sub('^[^-]*', outname, output_base)
729729

@@ -773,9 +773,8 @@ def run(arguments, content, options, state_machine, state, lineno):
773773
build_dir_link = build_dir
774774
source_link = dest_dir_link + '/' + output_base + source_ext
775775

776-
#If we previously preserved copies of the generated figures
777-
#this copies them into the build directory so that they will
778-
#not be remade
776+
# If we previously preserved copies of the generated figures this copies
777+
# them into the build directory so that they will not be remade.
779778
if config.plot_preserve_dir and outname:
780779
outfiles = glob.glob(
781780
os.path.join(config.plot_preserve_dir, outname) + '*')

0 commit comments

Comments
 (0)