我的文件中有一段代码,我想使用literalinclude指令将其包含在 Sphinx 文档的示例中。
但该代码位于一个函数中,因此当我包含它时,在示例中,每行缩进比我想要的多一级。
.. literalinclude:: ../../examples/example.py
:language: python
:lines: 13-42
:tab-width: 0
Run Code Online (Sandbox Code Playgroud)
生产
.. literalinclude:: ../../examples/example.py
:language: python
:lines: 13-42
:tab-width: 0
Run Code Online (Sandbox Code Playgroud)
还有其他方法可以删除或取消缩进文字块吗?
背景:我升级了我的存储库以使用 python 3.9(以前是 3.6)。将所有软件包升级到最新。注意到我的文档没有使用 sphinx-rtd-theme 进行格式化。请参阅https://docs.members.loutilities.com/en/1.4.1.dev1/与https://docs.members.loutilities.com/en/1.4.0/进行比较
使用 chrome 控制台查看了差异,在 1.4.0 中,格式化是通过https://docs.members.loutilities.com/en/1.4.0/_static/css/theme.css完成的,但是 theme.css 1.4.1.dev1 中缺少文件。
注意:恢复到旧的、之前工作的 rtd-requirements.txt 并不能解决问题。
回购代码位于https://github.com/louking/members/tree/1.4.1.dev1/docs
具体来说,conf.py 有以下内容
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to …Run Code Online (Sandbox Code Playgroud) 我已经在我的Windows XP系统和JSAPI设置上安装了Sphinx-4.我想将英语口语WAV(或MP3)文件转录成文本.
当我运行"WavFile"演示时 - 它成功运行.
java -jar WavFile.jar
Run Code Online (Sandbox Code Playgroud)
但是,当我传递我自己的wav文件时:
java -jar WavFile.jar c:\test.wav
Run Code Online (Sandbox Code Playgroud)
我明白了:
":文件:/ C:罐子/sphinx4-1.0beta3-bin/sphinx4-1.0beta3/bin/WavFile.jar /edu/cmu/sphinx/demo/wavfile/config.xml"中定义加载识别器...
解码的jar:文件:/ C:/sphinx4-1.0beta3-bin/sphinx4-1.0beta3/bin/WavFile.jar /edu/cmu/sphinx/demo/wavfile/12345.wav结果:一二三四五
似乎这个演示设置为加载和运行内部wav文件("12345.wav")或其他东西.
我已经阅读了文档,并且无法想象如何设置"config.xml"甚至是放置它的目录.我只是想尝试使用标准演示进行简单的概念验证.
所以,问题是:如何运行Sphinx4程序来转录wav文件?
谢谢.
你怎么能在底部解决狮身人面像的警告?
我想在Sphinx中获取我的Python笔记.我将我的笔记放在与index.rst相同的目录级别的单独文件中.
构建HTML后,我收到以下警告
警告
/home/heo/S_codes/trig_functions.rst:: WARNING: document isn't included in any toctree
Run Code Online (Sandbox Code Playgroud)
在
构建时的完整信息
sudo sphinx-build -b html ./ _build/html
Running Sphinx v0.6.2
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 1 added, 2 changed, 0 removed
reading sources... [100%] trig_functions
/home/heo/S_codes/databooklet.rst:1: (WARNING/2) malformed hyperlink target.
/home/heo/S_codes/index.rst:11: (ERROR/3) Error in "toctree" directive:
invalid option block.
.. toctree::
:numbered:
:glob:
*
databooklet.rst
trig_functions.rst
/home/heo/S_codes/trig_functions.rst:11: (ERROR/3) Unexpected indentation.
looking for …Run Code Online (Sandbox Code Playgroud) 是否有可能在sphinx文档生成器中使文本删除?
我在Python 3中编写了一个程序,并使用Sphinx来记录它.Sphinx的autodoc很棒,但它只适用于Python 2.有些模块在autodoc中工作正常,但模块却没有.一些例子:Python 2抱怨Python 3样式元类,以及一些在Python 2中不再存在的模块,如configparser.这很烦人,因为它无法从该文件导入文档字符串.
我不想在Python 2中重写整个程序,但我想使用autodoc.
我有一个想法是一个小程序,它读取每个Python文件并删除所有功能,但只是将基本函数和类与其文档字符串一起离开(因为autodoc导入每个模块并读取特定函数或类的文档字符串).
import configparser
import os
class TestClass:
"""
I am a class docstring.
"""
def method(self, argument):
"""
I am a method docstring.
"""
#Some code here
print(os.getcwd())
def TestFunction():
"""
I am a function docstring.
"""
#Some more useless code here
return os.path.join("foo", "bar")
Run Code Online (Sandbox Code Playgroud)
成...
class TestClass:
"""
I am a class docstring.
"""
def method(self, argument):
"""
I am a method docstring.
"""
pass
def TestFunction():
"""
I …Run Code Online (Sandbox Code Playgroud) source = '\xe3\xc7\x9f'
destination = u'\u0645\u0627\u06ba'
Run Code Online (Sandbox Code Playgroud)
我如何从源头到达目的地?
(源和目标都是相同的3个字符,顺序相同,只是表示不同.)
从技术上讲,源是在乌尔都语中,目标是相同3个字符的Unicode代码点.请参阅:https://www.codeaurora.org/git/projects/froyo-gb-dsds-7227/repository/revisions/39141d7a9dbdd2e9acf006430a7e7557ffd1efce/entry/external/icu4c/data/mappings/ibm-5352_P100-1998.ucm
如果我做:
source.decode('cp1006')
Run Code Online (Sandbox Code Playgroud)
我明白了:
u'\ufed9\ufb84\x9f'
Run Code Online (Sandbox Code Playgroud)
这不是我想要的......
如果我做:
source.decode('raw_unicode_escape')
Run Code Online (Sandbox Code Playgroud)
我明白了:
u'\xe3\xc7\x9f'
Run Code Online (Sandbox Code Playgroud)
这也不是我想要的......
如何从Python中的A点(源)到B点(目标)?
我正在尝试生成pdf,但我不知道如何在每个页面中添加页眉和页脚.我正在使用xsl-fo命名空间,这里是xsl代码的根.
<xsl:template match="ROOT">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4"
page-height="450mm" page-width="350mm" margin-top="20mm"
margin-bottom="20mm" margin-left="20mm" margin-right="20mm">
<fo:region-body border="solid thick black" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="SequenceMaster1">
<fo:repeatable-page-master-reference
maximum-repeats="3" master-reference="simpleA4" />
</fo:page-sequence-master>
</fo:layout-master-set>
<xsl:apply-templates />
</fo:root>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
和我的页面模板:
<xsl:template match="PAGE">
<fo:page-sequence master-reference="SequenceMaster1"
text-align="center">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="Arial" text-align="left"
language="tr">
<!-- ======================================Common Bigger table========================================================================================= -->
<fo:table width="100%" border-before-width="thin"
border-top-width="thick">
<fo:table-column column-width="310mm" />
<fo:table-body break-after="page" border-width="1mm" border-style="solid" height="410mm">
<fo:table-row>
<fo:table-cell padding-left="2mm" height="410mm">
<xsl:apply-templates />
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:template>
Run Code Online (Sandbox Code Playgroud) 我正在学习本教程,以便为我的Django项目生成文档.
我已经添加sys.path.append(os.path.join(os.path.dirname(__name__), '..'))到conf.py文档目录中的文件中.
但是运行make html一直给我这样的错误:
配置不正确:请求设置LOGGING_CONFIG,但未配置设置.您必须在访问设置之前定义环境变量DJANGO_SETTINGS_MODULE或调用settings.configure().
我的项目运行正常,所以我不确定我应该打电话到settings.configure()哪里?