Travis Brown
Travis Brown

Reputation: 139058

Substitutions next to angle brackets in Sphinx

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?

Upvotes: 2

Views: 695

Answers (1)

mzjn
mzjn

Reputation: 51052

This works:

.. parsed-literal::

   <version>\ |release|\ </version>

.. |release| replace:: 1.7.3

Reference: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#escaping-mechanism

Upvotes: 3

Related Questions