发布于 2015-09-16 15:36:24 | 166 次阅读 | 评论: 0 | 来源: 网络整理

This extension is quite simple, and features only one directive:

.. ifconfig::

Include content of the directive only if the Python expression given as an argument is True, evaluated in the namespace of the project’s configuration (that is, all registered variables from conf.py are available).

For example, one could write

.. ifconfig:: releaselevel in ('alpha', 'beta', 'rc')

   This stuff is only included in the built docs for unstable versions.

To make a custom config value known to Sphinx, use add_config_value() in the setup function in conf.py, e.g.:

def setup(app):
    app.add_config_value('releaselevel', '', True)

The second argument is the default value, the third should always be True for such values (it selects if Sphinx re-reads the documents if the value changes).

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务