Issues

Issue #290 resolved

Image files renamed on build - keep directory structure instead

Anonymous 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 (3)

  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