Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

BUG: plot_directive: look for plot script files relative to the .rst file #385

Closed
wants to merge 1 commit into from

5 participants

Pauli Virtanen Michael Droettboom John Hunter Benjamin Root Phil Elson
Pauli Virtanen
pv commented

BUG: plot_directive: look for plot script files relative to the .rst file directory (rather than doc source root), when plot_basedir is not given

A tiny fix to the plot directive -- it should look for the plot scripts relative to the current .rst file and not the source root specified on the command line.

Pauli Virtanen pv BUG: plot_directive: look for plot script files relative to the .rst …
…file directory (rather than doc source root), when plot_basedir is not given
172cb0a
Michael Droettboom
Owner

This breaks matplotlib's documentation build. That could be fixed by setting plot_basedir, but I think a better approach (more consistent with Sphinx itself) would be to follow the pattern of the image directive: relative paths are relative to the rst, absolute paths are relative to the documentation root. See http://sphinx.pocoo.org/rest.html#images

John Hunter
Owner

I believe this should be closed because it breaks mpl' documentation and has not been updated since Feb. Any objections?

Michael Droettboom
Owner

I think we should just delay it. Ideally, the plot directive should behave the same way as Sphinx/docutils built-in image directive for consistency. Once that is achieved, there are some changes to the doctree to make, of course.

Benjamin Root
Collaborator

Does this pull request need to be redone?

Phil Elson
Collaborator

Does this PR make the plot directive consistent with the sphinx directive? If so, we should get it in and fix our documentation, if not, then this issue should be closed (and not merged).

Michael Droettboom
Owner

I don't believe this PR does make it consistent with the Sphinx image directive.

Phil Elson
Collaborator

@pv: Based on the previous comments, I am closing this PR. If you think that we have mis-understood your change, please feel free to show us the error. We appreciate you taking the time to make this PR and for helping us to make mpl better.

Phil Elson pelson closed this
Pauli Virtanen
pv commented

The image:: directive handles the path argument as a relative to the source file (which was implemented in this PR), unless it begins with / in which case it's relative to the top dir (which was not implemented).

That would be a simple change to make, but I don't think that it's worth doing any more, as it just breaks backwards compatibility for a minor consistency improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 29, 2011
  1. Pauli Virtanen

    BUG: plot_directive: look for plot script files relative to the .rst …

    pv authored
    …file directory (rather than doc source root), when plot_basedir is not given
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/matplotlib/sphinxext/plot_directive.py
4 lib/matplotlib/sphinxext/plot_directive.py
View
@@ -88,7 +88,7 @@
plot_basedir
Base directory, to which ``plot::`` file names are relative
to. (If None or empty, file names are relative to the
- directoly where the file containing the directive is.)
+ directory where the file containing the directive is.)
plot_formats
File formats to generate. List of tuples or strings::
@@ -601,7 +601,7 @@ def run(arguments, content, options, state_machine, state, lineno):
if len(arguments):
if not config.plot_basedir:
- source_file_name = os.path.join(setup.app.builder.srcdir,
+ source_file_name = os.path.join(rst_dir,
directives.uri(arguments[0]))
else:
source_file_name = os.path.join(setup.confdir, config.plot_basedir,
Something went wrong with that request. Please try again.