生成假的intersphinx库存
sphinx-fakeinv的Python项目详细描述
有时我们创建的库太小,不需要使用 Sphinx对于它们,但同时我们可能希望将它们从 其他使用狮身人面像书写的文件。
这个实用程序帮助我们生成一个假的objects.inv文件 (它也被称为sphinx目录)以便其他sphinx文档可以链接 它通过Intersphinx扩展。
用法
假设您刚刚编写了一个名为foobar的小模块。你可以生成 一个假的objects.inv,通过以下命令:
$ sphinx-fakeinv foobar > objects.inv
shinx-fakeinv程序自动扫描子模块、子包, 以及所有扫描模块/包中的类/函数/异常/变量。 (注意,它知道__all__list(如果有的话)。
如果要从其他sphinx文档链接它,需要手动添加url 当然你需要上传生成的假objects.inv 像gh页)到intersphinx_mapping配置:
intersphinx_mapping={'foobar':('https://github.com/example/foobar',# The project website'https://example.github.io/foobar/objects.inv'# The fake inventory),}
够了!如果您引用foobar,例如:
If :mod:`foobar` module is available at runtime this function will uses internally :func:`foobar.baz()`.
上面例子中的链接如foobar和foobar.baz()将引用 到https://github.com/example/foobar。