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
[ ] Run make format and make check to make sure the code follows the style guide.
[ ] Add tests for new features or tests that would have caught the bug that you're fixing.
[ ] If adding new functionality, add an example to docstrings or tutorials.
Description of proposed changes
For a GMT code included in
source/chapter1/section1.rst
, the output image will be generated and stored asbuild/gmtplot_directive/chapter1/section1-gmtplot-{counter}.png
. The variablecounter
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
andsource/chapter2/section1.rst
), when the two imagesbuild/gmtplot_directive/chapter1/section1-gmtplot-0.png
andbuild/gmtplot_directive/chapter2/section1-gmtplot-0.png
are moved to thebuild/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
make format
andmake check
to make sure the code follows the style guide.