Sphinx 代码块内的替换不会被替换 [英] Substitutions inside Sphinx code blocks aren't replaced

查看:47
本文介绍了Sphinx 代码块内的替换不会被替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个由 Sphinx 渲染的 reST 示例中,|yaco_url|不会被替换,因为它位于代码块中:

In this reST example meant to be rendered by Sphinx, |yaco_url| doesn't get replaced because it's in a code-block:

.. |yaco_url| replace:: http://yaco.es/

You can use wget to download it:

.. code-block:: console

    $ wget |yaco_url|package.tar.gz

不知道有没有什么方法可以强制替换|yaco_url|在渲染代码块之前.

I wonder if there is some way to force the replacement of |yaco_url| before rendering the code block.

推荐答案

使用parsed-literal"指令.

Use the "parsed-literal" directive.

.. parsed-literal::

    ./home/user/somecommand-|version|

来源:https://groups.google.com/forum/?fromgroups=#!topic/sphinx-dev/ABzaUiCfO_8:

这篇关于Sphinx 代码块内的替换不会被替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆