0

I have been searching for a solution to this, but have just got even more confused!

I have a use case in my documentation to replace many instances of a name for a piece of equipment. I had been using the reST directive replace, so for instance:

.. |model| replace:: modelname

That works fine, but I reuse much of my documentation for different models, so what I really need to do is keep the model name in a text or reST file so that I don't have to go through all my source files to update. Something like:

.. |model| replace:: modelname.rst

Hope you follow that. I know you can include the contents of a file using the include directive, but I can't figure out how to achieve my use case.

Can anyone shed any light on how I can do this?

Thank you!

mzjn
  • 48,958
  • 13
  • 128
  • 248
Mark Lees
  • 1
  • 1
  • ...I did find a related thread: https://stackoverflow.com/questions/58930190/sphinx-and-restructuredtext-pass-parameter-in-include-directive which is similar to what I am looking to do, but I can't figure out how to apply this solution in my use case. I'm new to reST (and StackOverflow), so feeling my way! – Mark Lees Oct 22 '22 at 13:20
  • 1
    Is it `rst_epilog`/`rst_prolog` that you are looking for? https://stackoverflow.com/a/39214302/407651 – mzjn Oct 23 '22 at 05:12
  • 1
    Thank you so much! `rst_prolog` worked perfectly! – Mark Lees Oct 23 '22 at 08:34

0 Answers0