alt*_*ern 0 documentation markup restructuredtext docutils
如何.rst使用实际值自定义文件中的占位符?
例如,我有example.rst以下内容的文件:
Header
------------------------------------
${custom_text}
Run Code Online (Sandbox Code Playgroud)
我想通过运行以下命令将${custom_text}属性替换为值this is the value of custom property:
rst2html example.rst -o example.html -Dcustom_text="this is the value of custom property"
Run Code Online (Sandbox Code Playgroud)
另外我想知道是否可以使用.properties文件自定义模板?例如,我想rst2html example.rst -o example.html -p example.properties使用example.properties包含以下内容的文件运行命令:
custom_text=this is the value of custom property
Run Code Online (Sandbox Code Playgroud)
可能吗?reStructuredText是否支持模板功能?
编辑:请注意我想从命令行或使用传统.properties文件(可以由Ant/Maven构建管理工具使用)自定义模板.
使用该replace指令执行reStructuredText文件中的替换.例如:
I am using |RST|.
.. |RST| replace:: reStructuredText
Run Code Online (Sandbox Code Playgroud)
将导致文本
我正在使用reStructuredText.
您可以使用该include指令在单独的文件中定义替换模板列表.例如,给定以下两个文件:
example.rst:
Header
======
.. Include templates from external file (this is a comment).
.. include:: properties.rst
I can include text, like |my custom text|, from other files.
Run Code Online (Sandbox Code Playgroud)
properties.rst
.. |my custom text| replace:: "example text"
Run Code Online (Sandbox Code Playgroud)
将导致文件:
我可以在其他文件中包含文本,例如"示例文本".
在这里,我使用该命令rst2html.py example.rst生成HTML输出.
| 归档时间: |
|
| 查看次数: |
2099 次 |
| 最近记录: |