EnMAP-Box / enmap-box-documentation

Documentation of EnMAP-Box
GNU General Public License v3.0
3 stars 3 forks source link

replace repeated *.rst import by substitutions #77

Closed jakimowb closed 4 months ago

jakimowb commented 4 months ago

Several rst files include definitions for reference by

.. include:: /icon_links.rst

This way all references are loaded, including many that are not required at all.

It is better to use a script that appends only those definition, which are used before in the rst file. See https://github.com/qgis/QGIS-Documentation/blob/master/scripts/find_set_subst.py for details.

jakimowb commented 4 months ago

substitutes are now defined in source/substitutions_*.txt files. By now there are two:

source/substitutions_manual.txt contains manually defined substitutes, e.g:

.. |icon| image:: img/icon.png
   :width: 30px
   :height: 30px

.. |reg| unicode:: U+000AE .. REGISTERED SIGN

.. |esa| image:: img/logos/logo_esa.bmp

source/substitutions_generated.txt is created by scripts/create_substitutes_icons.py. It contains substitutes for the icons in img/icons/, like:

.. |action| image:: img/icons/action.svg
   :width: 28px
.. |ActionIdentifyTimeSeries| image:: img/icons/ActionIdentifyTimeSeries.svg
   :width: 28px

Run scripts/create_substitutes.py to check each .rst file for used subsitutes and append the their definitions to the end of the .rst file. E.g. as in source/usr_section/usr_gettingstarted.rst:


.. Substitutions definitions - AVOID EDITING PAST THIS LINE
   This will be automatically updated by the find_set_subst.py script.
   If you need to create a new substitution manually,
   please add it also to the substitutions.txt file in the
   source folder.

.. |combo| image:: /img/icons/combo.png
   :width: 28px
.. |enmapbox| image:: /img/icons/enmapbox.png
   :width: 28px
.. |link_all_mapscale_center| image:: /img/icons/link_all_mapscale_center.svg
   :width: 28px
.. |link_basic| image:: /img/icons/link_basic.svg
   :width: 28px
.. |mActionPan| image:: /img/icons/mActionPan.svg
   :width: 28px
.. |mouse_leftclick| image:: /img/icons/mouse_leftclick.svg
   :width: 28px
.. |mouse_wheel| image:: /img/icons/mouse_wheel.svg
   :width: 28px
.. |symbology| image:: /img/icons/symbology.svg
   :width: 28px
.. |viewlist_mapdock| image:: /img/icons/viewlist_mapdock.svg
   :width: 28px