GenericMappingTools / sphinx_gmt

Sphinx extensions for GMT
https://www.generic-mapping-tools.org/sphinx_gmt
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Name gmtplot images and scripts using code's md5sum value #53

Closed seisman closed 2 years ago

seisman commented 2 years ago

Description of proposed changes

For a GMT code included in source/chapter1/section1.rst, the output image will be generated and stored as build/gmtplot_directive/chapter1/section1-gmtplot-{counter}.png. The variable counter is the counter of GMT code in a single ReST file and it starts from zero. So, the images always have unique names and don't have conflicts.

When building the documentation, Sphinx will copy all images to the build/html/_images directory. If we have GMT code in two files that have the same basename (e.g., source/chapter1/section1.rst and source/chapter2/section1.rst), when the two images build/gmtplot_directive/chapter1/section1-gmtplot-0.png and build/gmtplot_directive/chapter2/section1-gmtplot-0.png are moved to the build/html/_images/ directory, they will cause conflicts. Fortunately, Sphinx can automatically deal with the conflicts, so it still works.

This PR tries to avoid the conflicts using the code's md5sum value as basename of both scripts and images.

Reminders