从测试文件自动生成mini-rst文档(代码块+svg)
minidoc的Python项目详细描述
安装
$ pip3 install minidoc
许可证
- 麻省理工学院
快速启动
pip3安装minidoc
创建一个workdir,例如“test”
mkdir TEST cd TEST
编辑code.tst.py如下:
cat code.tst.py
run命令minidoc,
将自动执行code.tst.py中的代码,
并自动保存终端屏幕快照(或录制)
并自动生成.rst doc文件
minidoc tree TEST# tree . ├── code.tst.py ├── images------------------------------->generated svgs │ ├── __getitem__.svg │ └── __init__.svg └── Usage.rst---------------------------->generated .rst 1 directory, 4 files TEST#
- open generated.rst检查它
minidoc-h
TEST# minidoc -h usage: minidoc [-h] [-tst TEST_FILE] [-codec CODEC] [-still STILL_FRAMES] [-rows ROWNUMS] [-dst DST_DIR] [-title TITLE] [-tbot TITLE_BOT] [-ebot ENTRY_BOT] optional arguments: -h, --help show this help message and exit -tst TEST_FILE, --test_file TEST_FILE .tst.py file name,default = "code.tst.py" -codec CODEC, --codec CODEC .tst.py file codec,default = "utf-8" -still STILL_FRAMES, --still_frames STILL_FRAMES generate screen shot,default = True (which means still image but not recording) -rows ROWNUMS, --rownums ROWNUMS screen height,default = 30 -dst DST_DIR, --dst_dir DST_DIR destination svg dir, default ="./images" -title TITLE, --title TITLE parent title, default = "Usage" -tbot TITLE_BOT, --title_bot TITLE_BOT parent title bottom char, default = '=' -ebot ENTRY_BOT, --entry_bot ENTRY_BOT entry title bottom char, default = '-'
用法
源代码
In progressing.....
从命令行
# screen shot root@# minidoc -tst code.rst.py -dst ./images # screen recording root@# minidoc -tst code.rst.py -dst ./images -still false # on current dir,screen shot root@# minidoc -still true # on current dir,screen recording root@# minidoc -still false
功能
- 从.tst.py自动生成.rst文档
- .tst.py中的自动执行测试代码
- 自动录制屏幕并另存为.svg
限制
- 目前只支持python3
待办事项
- javascript
- lua
- tclsh
参考文献
- termtosvg
- 列表
- EFDIR
- 限制