Image files renamed on build - keep directory structure instead

Anonymous avatarAnonymous created an issue

Our Sphinx "source" directory looks something like this :

 |---- manual-A
      |---- images
            | somethingA.png
      | chap-A-1.rst
      | chap-A-2.rst
 |---- manual-B
      |---- images
            | somethingB.png
      | chap-B-1.rst
      | chap-B-2.rst

From Sphinx' point for view, it's one manual, but we tend to think of it as two separate manuals, since the two sections have completely separate authors. Each sub-manual has it's own images/ directory.

When we build the HTML, all the images are copied to a flat build/ _images directory.

If there are two different images, with the same name, in different parts of the source tree, Sphinx renames one of them when it is copied to the output _images directory (it append a number).

I would prefer that for images Sphinx keep the original directory structure and filenames, rather than renaming them.

There is no benefit to renaming them, but various drawbacks. Since there is no way of recovering, from the generated HTML, the original location, it is confusing for authors. The requirement to rewrite the location and filename when generating HTML seems to invite possible bugs for no benefit.

Comments (2)

  1. Anonymous

    I'm having the same issue. In my case, I have files with the same name in the image subfolders -- Sphinx is renaming one of them (appending a "1") and putting in the same folder.

    http://sphinx.pocoo.org/changes.html shows "#60: Fix wrong generated image path when including images in sources in subdirectories"

    Did this revert for some reason?

    .

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.