以控制台友好且可读的方式格式化通过其结构指定的文档
RecursiveDocument的Python项目详细描述
不要使用这个库:它是为了支持InteractiveCommandLine, 而click库则要好得多。 我不会修复库中的任何内容,我正在将自己的项目迁移到click。
recursivedocument是一个python(2.7+和3.3+)库格式,以控制台友好和可读的方式, 通过其结构(节、小节、段落等)指定的文件。 它特别适合打印命令行可执行文件的帮助消息。
它是根据MIT license授权的。 在Python package index上有售, 它的documentation is hosted by Python 它的源代码在GitHub上。
快速启动
从pypi安装:
$ pip install RecursiveDocument
导入:
>>> from RecursiveDocument import *
创建文档:
>>> doc = Document().add( ... Section("Introduction") ... .add("This is the first paragraph of a very interesting story. It begins with this paragraph.") ... .add("After the first paragraph comes the second paragraph. As incredible as it may sound, it can go on and on and on...") ... )
并打印出来:
>>> print doc.format() Introduction This is the first paragraph of a very interesting story. It begins with this paragraph. <BLANKLINE> After the first paragraph comes the second paragraph. As incredible as it may sound, it can go on and on and on...