问题
I'm trying to use substitutions in a parsed literal block in my Sphinx documentation like this:
<dependency>
...
<version>|release|</version>
</dependency>
Which gets rendered like this:
<dependency>
...
<version>|release|</version>
</dependency>
Where what I want is this:
<dependency>
...
<version>1.7.3</version>
</dependency>
If I add spaces around the substitution in the source, I get this:
<dependency>
...
<version> 1.7.3 </version>
</dependency>
So I know release
is defined as I expect. How can I get rid of the spaces?
回答1:
This works:
.. parsed-literal::
<version>\ |release|\ </version>
.. |release| replace:: 1.7.3
Reference: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#escaping-mechanism
来源:https://stackoverflow.com/questions/25557602/sphinx-substitutions-next-to-angle-brackets