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

Paolo Corti pcorti at gmail.com
Wed Jul 4 10:05:23 PDT 2012


On Wed, Jul 4, 2012 at 6:32 PM, Diethard Jansen
<diethard.jansen at gmail.com> wrote:
> 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

Hi
the idea would be to have a common place where to store substitution
only for images that are in many pages.
I believe that a big part of the ones that now are in conf.py are used
only once in the user guide, so it would make sense to me to leave in
conf.py only the images that are used more times, and place the other
to each single page.
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the Qgis-community-team mailing list