【问题标题】:Substitutions next to angle brackets in SphinxSphinx中尖括号旁边的替换
【发布时间】:2014-08-28 20:38:33
【问题描述】:

我正在尝试在 parsed literal block 中使用 substitutions 在我的 Sphinx documentation 中,如下所示:

<dependency>
  ...
  <version>|release|</version>
</dependency>

渲染如下:

<dependency>
  ...
  <version>|release|</version>
</dependency>

我想要的是这个:

<dependency>
  ...
  <version>1.7.3</version>
</dependency>

如果我在源代码中的替换周围添加空格,我会得到:

<dependency>
  ...
  <version> 1.7.3 </version>
</dependency>

所以我知道release 的定义符合我的预期。我怎样才能摆脱这些空间?

【问题讨论】:

    标签: python versioning python-sphinx substitution restructuredtext


    【解决方案1】:

    这行得通:

    .. parsed-literal::
    
       <version>\ |release|\ </version>
    
    .. |release| replace:: 1.7.3
    

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

    【讨论】:

      猜你喜欢
      • 2020-05-21
      • 1970-01-01
      • 2015-07-30
      • 1970-01-01
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多