在过去的几天里,我一直在调查FOP apache项目中希伯来语字母对生成PDF文件的支持.
我看到过去有一个问题,我真的不明白它是否已经解决了?
如果有支持,有人可以显示/重定向我简单的样本给我带有希伯来字母的XSL-FO文件,当使用FOP时,PDF正确生成(清晰且不通过订单字母反转).
我真的很感激你的回答.这件事真的很困扰我,我想因为这个而转向IText ......
我有一个 Python 项目,在函数中写了很多文档字符串,
如何通过一两步将这些 docstring 转换为 html 文档,
我只希望 Sphinx 可以充当 doxygen,只需将我所有的评论或文档转换为 html 文档。
我sphinx-quickstart在docs文件夹下运行
然后
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
Run Code Online (Sandbox Code Playgroud)
然后修改了conf.py long_term_streaming_monitor/docs/source/conf.py
sys.path.insert(0, os.path.abspath('../../src'))
Run Code Online (Sandbox Code Playgroud)
因为我所有的源代码都放在 long_term_streaming_monitor/src
生成的代码在这里下载
我遵循了教程,但是当我打开 index.html 时,我什么也没得到,html 文件链接上没有列出模块和方法
.
??? docs
? ??? _build
? ? ??? doctrees
? ? ??? html
? ? ??? _sources
? ? ??? _static
? ??? _static
? ??? _templates
? ??? html
??? src
??? long_term_streaming_monitor
? …Run Code Online (Sandbox Code Playgroud) Django我使用为我的应用程序创建了一组文档Sphinx。我用来readthedocs.org创建该文档的公共版本。这很有效,但有一个奇怪的地方。我的readthedocs.org一些文档生成与本地构建不同。例如,对于我models.py创建的models.rst,它看起来像这样:
Models
======
.. automodule:: my_app.models
Agents
------
Agent
`````
.. autoclass:: Agent
:members:
etc...
Run Code Online (Sandbox Code Playgroud)
对于本地构建,这将创建一个文档,其中模型名称作为标题,其文档字符串及其成员(其中#: comment...添加了文档字符串)。
然而,readthedocs.org仅生成每个模型的标题条目,仅此而已。
看起来好像readthedocs.org忽略了automodule和autoclass指令。
最初我认为这是由主题差异引起的(我bootstrap在本地使用主题,在 上使用readthedocs主题readthedocs.org),但是在设置了virtualenvonreadthedocs.org并在那里使用bootstrap主题后,没有任何变化。构建已完成,但我的模型的文档仍然缺失。
我在本地使用Sphinx 1.2.2. 我不确定 readthedocs.org 使用的是哪个版本,但我推测是 1.2.x 版本。
关于可能导致这种情况的任何想法?
我在 rst 文件中有以下内容:
.. code-block:: bash
user@adi:~/workspace$ pytest
test/test/functional/example/test_api_2.py
--testbed test/test/topo_confs/pytest_tb.json
--loglevel DEBUG --html /home/user/test.html --self-contained-html
Run Code Online (Sandbox Code Playgroud)
现在如何在该代码中的pytest_tb.json单词上放置超链接?
class torch.FloatStorage[source]
byte()
Casts this storage to byte type
char()
Casts this storage to char type
Run Code Online (Sandbox Code Playgroud)
我正在尝试完成一些文档,我设法获得了如上所示的格式,但我不确定如何提供该函数末尾的源代码链接!该链接将人带到包含代码的文件,但我不知道该怎么做,
我已经浏览了许多 Sphinx 教程,但我仍然无法弄清楚如何将 Sphinx 文档变成一个像这样的简单 Python 脚本:
def addNumbers(a):
"""This function adds one to the given number.
:param a: The name to use
:type a: int
"""
b = a + 1
print b
addNumbers(5)
Run Code Online (Sandbox Code Playgroud)
下面是我做的步骤。我错过了什么?
安装狮身人面像:
pip install sphinx
Run Code Online (Sandbox Code Playgroud)
在我的项目目录中创建一个文档目录:
mkdir docs
Run Code Online (Sandbox Code Playgroud)
sphinx-quickstart从新doc目录内部运行并按 Enter 回答除以下两个问题之外的所有问题:
Separate source and build directories (y/n) [n]: y
autodoc: automatically insert docstrings from modules (y/n) [n]: y
Run Code Online (Sandbox Code Playgroud)
这使得我的项目目录结构变成这样:
myproject/
|-- docs/
|-- build/
|-- source/
make.bat
Makefile
|-- mycode/
myscript.py
Run Code Online (Sandbox Code Playgroud)
打开 …
目前,我有一些使用 mypy 类型注释的代码,如下所示:
def translate(self, text, mark_unknown=False, format=None, deformat='txt', reformat='txt'):
# type: (Translator, str, bool, Optional[str], str, str) -> str
Run Code Online (Sandbox Code Playgroud)
我想用 Sphinx 的 autodoc 扩展来记录它,但似乎 autodoc 当前无法识别这些注释,因此这些注释不会出现在生成的文档中。
对此是否有任何简单的解决方法,例如另一个扩展或 autodoc 选项,或者我必须编写包含相关信息的实际文档字符串?
在我的 Python 项目中,我使用 Pytest。目录结构为:
src/
docs/
test/
Run Code Online (Sandbox Code Playgroud)
我有不同类型的测试:
test/*src/*docs/*.rst(Sphinx)我想一次运行所有这些,这样我就可以汇总所有这些的统计数据(例如覆盖范围)。
pytestpytest --doctest-modules srcpytest --doctest-glob="docs/*.rst" docs我成功地运行了它们:
pytest --doctest-modules src test pytest --doctest-glob="docs/source/*.rst"如何在一个命令中运行所有这些?也许问题比我想象的要简单......
有没有一种简单的方法可以在sphinx中格式化方法签名?我正在使用 RTD 主题,并构建为 html。
我目前遇到的问题是:
使用输入模块创建的自定义类型注释正在以其完整形式打印,但我希望只打印它们的名称(例如CustomType = Union[type1, type2, type3]应该呈现为 simple CustomType,但会呈现为Union[type1, type2, type3]相反)
方法签名打印在一行上,我希望将其打印为缩进的自定义表单
方法签名应该以某种方式突出显示语法,就像在 IDE 中一样
我不确定如何实现这些自定义,对我来说似乎 html 主题配置中没有任何选项可以这样做。
我尝试的第一件事是类似这段代码,但我有点卡住了。
一开始我也想过做一个 sphinx 的分支(就像这个用户尝试解决另一个恼人的问题[PR]),但后来我意识到,如果你不太了解这个项目,这样的事情真的很复杂出色地...
如有必要,我将提供更多详细信息。
考虑以下功能
# in mymodule.py:
def myfunc(num,mystring):
"""
replicates a string
:param num: a positive integer
:param mystring: a string
:return: string concatenated with itself num times
:Example:
>>> num = 3
>>> mystring = "lol"
>>> myfunc(num, mystring)
"lollollol"
"""
return num*mystring
Run Code Online (Sandbox Code Playgroud)
如果我使用Sphinx从我的文档字符串生成代码,则看起来像这样(这次我使用的是默认主题haiku,在rstor conf.py文件中没有太多更改):
是否有任何主题或其他变通办法可以解决我用颜色指示的问题?
我尝试了不同的方法,但均无效果,但我无法获得1.-4的任何要点。去工作。
编辑的想法是,我不想要编辑的HTML,这是方式繁琐。我只想对Sphinx 目录中的conf.py和index.rst文件进行更改docs,以进行上述更改。