我正在使用Sphinx为我的项目生成文档。
在这个项目中,我用yaml文件描述了一系列可用的命令,一旦加载,就会得到一个形如{command-name : command-description}
的字典,例如:
commands = {"copy" : "Copy the highlighted text in the clipboard",
"paste" : "Paste the clipboard text to cursor location",
...}
我想知道的是,是否有一种方法在sphinx的“make html”周期中加载yaml文件,将python字典翻译成某种reStructuredText格式(例如定义列表),并包含在我的html输出中。我期望我的.rst文件看起来像这样:
Available commands
==================
The commands available in bla-bla-bla...
.. magic-directive-that-execute-python-code::
:maybe python code or name of python file here:
并且需要在内部转换为:
Available commands
==================
The commands available in bla-bla-bla...
copy
Copy the highlighted text in the clipboard
paste
Paste the clipboard text to cursor location
在被翻译成HTML之前。