I am a newbie in Sphinx and reStructuredText.
I have n rst files in which I would like to insert a similar text (not code):
Hello Earth.
or
Hello Mars.
or
Hello Saturn.
My idea is to include in my rst files a common rst file.
.. include:: planet.rst
with planet.rst and a placeholder for the planet in this file:
Hello <planet>.
My current solution is: planet.rst:
Hello Earth.
Hello Mars.
Hello Saturn.
and in my n rst files, e.g. for planet Mars:
.. include:: planet.rst
:start-line: 1
:end-line: 2
I am looking for a better solution.
I didn't found a purposeful option for the include directive in http://docutils.sourceforge.net/docs/ref/rst/directives.html
How can I pass a parameter (variable/value) to the included file to replace placeholder?
Thank's for your hints Thomas
The directive for "Replacement Text (replace
)" should work with included files.
planet.rst
:
Hello |planet|.
earth.rst
:
.. |planet| replace:: Earth
.. include:: planet.rst