[Qgis-community-team] automatically create substitutions for icons in global.rst

Diethard Jansen diethard.jansen at gmail.com
Wed Jul 4 09:32:05 PDT 2012


Hi,

Yesterday I started with adding some substitutions for icons used in the
RST file I am working on.
'working_with_vector.rst' contains many! It is not too hard but.. to
include them only in the document I am working on.
I found that substitutions for Icons like |nix| are defined in conf.py, but
I do not like the idea of adding the new definitions in there.
On the following interesting site I found an alternative way.

http://packages.python.org/an_example_pypi_project/sphinx.html#substitutions

The idea:
I want to automatically create a global.rst using a python script to
include all substitutions to images of icons in there.
The script will search and include all png files < 8 kb that will be found
under directories "img/en/".
In the latex script most substitutions are equal to the icon name so it
should not be too hard to generate this file.

The advantage is that you only need to to include a single 'include' line
referring to the global.rst file and most of the icons should show up
immediately after the build. Another advantage is that you can remove most
of these substitions from config.py so it is less cluttered and it does not
need to be changed too often which (I believe) could break the build
process. It is also an easier place to find the substitutions. A
disadvantage could be that in a few places the reference needs to be
changed in the rst file because it was not equal to the name of the file.
(i.e. in rst file -> |labeling|  however the image::
../img/en/mActionLabeling.png, so in that case I will need to change it to
|mActionLabeling|).

Whatever, I will write the python script. I am sure the result can also be
quickly included in the config.py instead of the global.rst.
Let me know when you see a problem with this idea.

Regards,
Diethard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-community-team/attachments/20120704/bea1daa3/attachment.html>


More information about the Qgis-community-team mailing list