FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

matplotlib.sphinxext.plot_directive generates incorrect links when using dirhtml builder · Issue #13858 · matplotlib/matplotlib · GitHub

Repository navigation

matplotlib.sphinxext.plot_directive generates incorrect links when using dirhtml builder #13858

Closed

Description

When using the dirhtml builder in sphinx with the .. plot:: directive, the generated links are relative to the source file tree not the output, i.e. the source file name become a directory containing index.html, however the relative path generated is based on the location of the source file

dest_dir_link = os.path.join(relpath(setup.confdir, rst_dir),

I fixed this locally using the the following hack, however I don't think this is the appropriate solution there should be some way to make the directive use the output path not the input path, which would remove the need for a hack solution. Hence I'm posting this as a issue rather than a patch.

    if setup.app.builder.name == 'dirhtml':
        subdir = os.path.basename(os.path.splitext(rst_file)[0])
        dest_dir_link = os.path.join(relpath(setup.confdir, os.path.join(rst_dir, subdir)),
                                     source_rel_dir).replace(os.path.sep, '/')
    else:
        dest_dir_link = os.path.join(relpath(setup.confdir, rst_dir),
                                     source_rel_dir).replace(os.path.sep, '/')

Activity

  1. anntzer commented on Apr 3, 2019

    Contributor

    Related to #12456, perhaps(?).

  2. MikhailRyazanov commented on Oct 17, 2022

    Contributor

    PR #24205 seems to solve this issue in a more robust way. If anybody is still interested, please test it.

  3. QuLogic commented on Nov 24, 2022

    Member

    I confirmed that this works now by copying the test tinypages/some_plots.rst into a subdirectory and building before and after the above PR. The download links are now working, and not using broken relative paths.

  4. added this to the v3.7.0 milestone on Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL