降价的一个子集
submark的Python项目详细描述
子标记
降价的子集
这个项目以一个示例项目开始,描述如何利用flit、tox、coverage和pytest从脚本迁移到包。
这个故事见http://testandcode.com/80。
功能
转换标题
# heading
->;<h1> heading </h1>
## heading
->;<h2> heading </h2>
### heading
->;<h3> heading </h3>
#### heading
->;<h4> heading </h4>
##### heading
->;<h5> heading </h5>
转换为强
**strong**
->;<strong>strong</strong>
__strong__
->;<strong>strong</strong>
转换em
**something**
->;<em>something</em>
__something__
->;<em>something</em>
链接
[message](http://some.link.html "my title")
->;<a href="http://some.link.html" title="my title">message</a>
[message](http://some.link.html)
->;<a href="http://some.link.html">message</a>
图像
![alt](/some/image.png "title")'
->;'<img src="/some/image.png" title="title"/>
内联代码
this is `some code`
->;this is <code>some code</code>
文本结尾有两个空格的换行符
水平规则,3个或更多破折号
---
->;<hr>
用法
像这样使用:
$ submark something.md > something.html
或:
$ cat something.md | submark > something.html
或:
$ echo '**hi**' | submark
<strong>hi</strong>
开发和测试虚拟环境
测试和开发应该在虚拟环境中完成。
$ git clone https://github.com/okken/submark.git
$ cd submark
$ python3 -m venv venv --prompt submark
$ source venv/bin/activate
(submark) $ pip install -U pip
测试
使用tox
完成测试
(submark) $ pip install tox
(submark) $ tox
发展
开发需要一些工具。 在本地安装submark并使用flit安装开发工具。
(submark) $ pip install flit
(submark) $ flit install --pth-file
然后可以使用pytest在本地测试任何更改。
(submark) $ pytest --cov=submark
当准备好将所有内容作为已安装的软件包进行测试时:
(submark) $ tox
制造车轮
确保在运行flit
之前提交所有内容。
(submark) $ pip install flit
(submark) $ flit build
是的。就这样。
现在应该有一个轮子放在dist
文件夹中
(submark) $ ls dist
submark-0.5-py2.py3-none-any.whl
submark-0.5.tar.gz
展开
弗利特也这么做。
(submark) $ flit publish
但除非:
- 你是布莱恩·奥肯
或:
历史记录
- 0.1初始脚本和测试
- 0.2制造带传单的车轮
- 0.3建立并测试毒性
- 0.4将源模块移动到包目录中
- 0.5将测试移到测试目录中
- 0.6在toml文件中连接自述文件
- 0.7分
- flit for development with需要额外的,
- 支持链接、图像、内联代码、换行符、水平规则