docutils

Python convert sphinx RST to HTML

北战南征 提交于 2021-02-10 02:55:27
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?

Python convert sphinx RST to HTML

﹥>﹥吖頭↗ 提交于 2021-02-10 02:48:45
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?

Python convert sphinx RST to HTML

不问归期 提交于 2021-02-10 02:47:49
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?

Python convert sphinx RST to HTML

被刻印的时光 ゝ 提交于 2021-02-10 02:47:10
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?

How to create referenceable label node above section in sphinx

大兔子大兔子 提交于 2021-02-08 09:17:37
问题 I am creating a custom directive in sphinx. This directive lists all possible objects (each one in separate section). Now I would like those objects to be referenceable from other parts (files) of documentation. I was trying to do something very simple like: class MyDirective(Directive): def run(self, obj): id1 = 'object-unique-id1' id2 = 'object-unique-id2' label = nodes.label('abc1', refid=id1) section = nodes.section(ids=[id2]) section += nodes.title(text='abc') section += label return

Generating labels for nodes of a custom directive

蹲街弑〆低调 提交于 2021-01-04 03:13:48
问题 Using the Sphinx "TODO" Directive example I would like to reference the todo instances embedded within a .rst file. For example, if the .rst file content contains: .. todo:: foo .. todo:: bar I can see that the following code (taken from the Sphinx TODO example page) class TodoDirective(SphinxDirective): # this enables content in the directive has_content = True def run(self): targetid = 'todo-%d' % self.env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) todo_node =

Generating labels for nodes of a custom directive

风格不统一 提交于 2021-01-04 03:13:19
问题 Using the Sphinx "TODO" Directive example I would like to reference the todo instances embedded within a .rst file. For example, if the .rst file content contains: .. todo:: foo .. todo:: bar I can see that the following code (taken from the Sphinx TODO example page) class TodoDirective(SphinxDirective): # this enables content in the directive has_content = True def run(self): targetid = 'todo-%d' % self.env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) todo_node =

Generating labels for nodes of a custom directive

允我心安 提交于 2021-01-04 03:12:35
问题 Using the Sphinx "TODO" Directive example I would like to reference the todo instances embedded within a .rst file. For example, if the .rst file content contains: .. todo:: foo .. todo:: bar I can see that the following code (taken from the Sphinx TODO example page) class TodoDirective(SphinxDirective): # this enables content in the directive has_content = True def run(self): targetid = 'todo-%d' % self.env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) todo_node =

Generating labels for nodes of a custom directive

不打扰是莪最后的温柔 提交于 2021-01-04 03:12:27
问题 Using the Sphinx "TODO" Directive example I would like to reference the todo instances embedded within a .rst file. For example, if the .rst file content contains: .. todo:: foo .. todo:: bar I can see that the following code (taken from the Sphinx TODO example page) class TodoDirective(SphinxDirective): # this enables content in the directive has_content = True def run(self): targetid = 'todo-%d' % self.env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) todo_node =

SVN 向 GIT 进行转换如何拉取所有提交记录

隐身守侯 提交于 2020-10-09 02:32:48
如果你只想拉取 Trunk 分支的提交记录的话。 我们以项目 https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/ 为示例 我们希望将上面项目的所有 Trunk 的提交记录变成 Git 的仓库。 你可用运行命令: git svn clone https://svn.code.sf.net/p/docutils/code/trunk docutils 进行拉取就可以了。 请注意,如果你的提交记录非常多的话,有可能会拉取失败,如果你的计算机网络状况不是非常好,或者你计算机有自动休眠功能的话,也会拉取失败。 建议你在服务器上做,那么的效率会更高。 我们因为网络问题就没有拉完成。 https://www.ossez.com/t/svn-git/186 来源: oschina 链接: https://my.oschina.net/honeymoose/blog/4318015