Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple substitutions with rst_prolog in Sphinx

How do I define multiple global substitutions in Sphinx?

I see in this question how to create global substitutions using rst_prolog in conf.py. E.g.,

rst_prolog = '.. |my_conf_val| replace:: 42'

All examples of this that I can find only define one substitution in rst_prolog, but I want to do more than one. I tried this:

rst_prolog = """.. |sub1| replace:: mine1\
         .. |sub2| replace:: mine2"""

When I put |sub1| into text in an rst file, |sub1| is (not surprisingly) replaced with:

mine1 .. |sub2| replace:: mine2

What is the correct syntax here?

like image 446
user327301 Avatar asked Feb 11 '23 20:02

user327301


1 Answers

Make sure that the alignment of the substitution definitions is consistent. Backslashes are not needed. This works:

rst_prolog = """
.. |sub1| replace:: mine1
.. |sub2| replace:: mine2
"""
like image 110
mzjn Avatar answered Feb 14 '23 14:02

mzjn