简体   繁体   English

Sphinx 中尖括号旁边的替换

[英]Substitutions next to angle brackets in Sphinx

I'm trying to use substitutions in a parsed literal block in my Sphinx documentation like this:我正在尝试在我的Sphinx 文档中的解析文字块中使用替换,如下所示:

<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.所以我知道release是按照我的预期定义的。 How can I get rid of the spaces?我怎样才能摆脱空格?

This works:这有效:

.. parsed-literal::

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

.. |release| replace:: 1.7.3

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM