无政府主义的主题和对狮身人面像的迅速支持。
anarchy-sphinx的Python项目详细描述
内容
这是一个用于无政府工具swift文档的简单主题。
Installation
Via package
下载包或将其添加到requirements.txt文件:
$ pip install anarchy-sphinx
在conf.py文件中:
# documentation extractor and swift specific commandsextensions=["swift_domain"]# anarchy themeimportanarchy_themehtml_theme="anarchy_theme"html_theme_path=[anarchy_theme.get_html_theme_path()]
Via git or download
将anarchy_sphinx/anarchy_theme存储库符号链接或子树到位于 docs/_themes/anarchy_theme和anarchy_sphinx/swift_domain到docs/_extensions/swift_domain 然后将以下两个设置添加到sphinx conf.py文件中:
# documentation extractor and swift specific commandsimportosimportsyssys.path.insert(0,os.path.abspath('_extensions'))extensions=["swift_domain"]# anarchy themehtml_theme="anarchy_theme"html_theme_path=["_themes",]
Changelog
0.3.1:
- 未启用边栏时修复布局
- 实验:生成像doc2dash这样的锚需要它们。如果有什么东西坏了,告诉我!
0.3.0:
- 修复主题中的表呈现
- 使溢出的代码框可滚动
- 切换到活动目录项的粗体样式
- 错误修复:右对齐的图像是左对齐的
- 在顶部栏的导航项前面添加项目符号以区分它们
0.2.0:
- 将anarchysphinx命令行工具添加到引导文档中
Swift auto documentation extractor
如果你想使用swift的doc字符串提取器,你需要通知sphinx 存放*.swift文件的地方。
swift_search_path=["../src"]
如果设置好了,可以使用.. autoswift:: <symbol>让文档管理器搜索 对于swift符号并导入文档。
您可以设置一些标志来配置文档行为:
- :noindex:不要添加到索引
- :noindex-members:不索引成员
- :members:文档成员,可选:要包含的成员列表
- :recursive-members:递归地记录成员(嵌套在类中的枚举等)
- :undoc-members:包含不带docstring的成员
- :nodocstring:不显示文档字符串
- :file-location:添加具有文件位置的段落
- :exclude-members:排除这些成员
- :private-members:显示私人成员
Manual documentation for Swift types
如果指令声明 文档您可以跳过相应的swift关键字(例如:.. swift:class:: Classname)
- .. swift:function::顶层函数
- .. swift:class::类定义
- .. swift:struct::结构定义
- .. swift:enum::enum定义
- .. swift:protocol::协议定义
- .. swift:extension::协议的扩展和默认实现
- .. swift:method::func签名
- .. swift:class_method::类函数
- .. swift:static_method::结构或协议中的静态方法
- .. swift:init::初始值设定项
- .. swift:enum_case::enum案例
- .. swift:let::let常量
- .. swift:var::变量
- .. swift:static_let::静态let常量
- .. swift:static_var::静态变量
所有这些都有一个:noindex:参数来将其排除在索引之外。
^{tt1}$ command line tool
usage: anarchysphinx [-h] [--private] [--overwrite] [--undoc-members] [--no-members] [--file-location] [--no-index] [--no-index-members] [--exclude-list file] [--use-autodocumenter] source_path documentation_path Bootstrap ReStructured Text documentation for Swift code. positional arguments: source_path Path to Swift files documentation_path Path to generate the documentation in optional arguments: -h, --help show this help message and exit --private Include private and internal members --overwrite Overwrite existing documentation --undoc-members Include members without documentation block --no-members Do not include member documentation --file-location Add a paragraph with file location where the member was defined --no-index Do not add anything to the index --no-index-members Do not add members to the index, just the toplevel items --exclude-list file File with exclusion list for members --use-autodocumenter Do not dump actual documentation but rely on the auto documenter, may duplicate documentation in case you have defined extensions in multiple files
Generate Dash docsets with sphinx
将以下内容添加到sphinxMakefile中。你需要PIP包 doc2dash已安装以使其正常工作。
在变量声明部分的顶部:
PROJECT_NAME=myproject
在帮助文本部分:
@echo " dashdoc to make Dash docset"
低于html目标:
.PHONY: dashdoc dashdoc: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) -D 'html_sidebars.**=""' $(BUILDDIR)/dashdoc doc2dash -v -n $(PROJECT_NAME) -d $(BUILDDIR)/ -f -I index.html -j $(BUILDDIR)/dashdoc @echo @echo "Build finished. The Docset is in $(BUILDDIR)/$(PROJECT_NAME).docset."
并使用make dashdoc
运行生成