rst2tile是docutils纺织作者将structuredtext(rst)转换为纺织格式。
rst2textile的Python项目详细描述
rst2textile是Docutils Textile Writer将structuredText(RST)转换为纺织格式。
功能
- 纺织文档编写器。
- 支持的语法是:
- 标题:H1/H2..
- 文档信息:字段列表(如rst文件顶部的:date:today)。
- 段落
- 强调:*em*
- 强:**强**
- 列表项:*egg
- 枚举项:。火腿
- 方块引号
- 链接:`foo<;http://example.com/>;`
- 图片:。图片:http://example.com/image.png
- 文字:``一些代码`和:
- 支持的语法是:
- 斯芬克斯纺织建筑商(实验)。
- 写入conf.pyextensions=['docutils\u textile']
- 由Sphinx Build-B纺织原料制造/纺织
安装
$ pip install rst2textile
如果要使用未释放版本,可以从存储库安装:
$ pip install -e hg+https://bitbucket.org/shimizukawa/rst2textile#egg=rst2textile
运行
$ rst2textile.py input.rst output.txt
或:
$ python -m rst2textile input.rst output.txt
测试
$ python setup.py test
或:
$ python test.py
取决于
- python 2.6、2.7、3.3、3.4
- docutils 0.12、0.11、0.10
限制
- 不支持:某些纺织语法位于http://redcloth.org/textile
待办事项
- 文档
- 实现一些纺织格式。
更改
0.2.1(2014/10/04)
- 修正:表列的数目减少到较短的行。
0.2.0(2014/10/04)
- 添加支持纺织表输出。感谢tell-k.
- 删除pysetup相关行。
- 更改支持的Python版本:2.6、2.7、3.3、3.4
- 更改支持的docutils版本:0.12、0.11、0.10
0.1.1(2012/4/29)
- 添加支持的python版本:2.4、2.5、2.6、3.1、3.2、3.3
0.1.0(2012年4月22日)
- 首次发布
- 支持的语法:h1/h2..,docinfo,paragraph,em,strong,list item,enum item,blockquote,link,image,literal
转换样本
头部1
重新设置:
========== Heading1 ==========
纺织品:
h1. Heading1
标题
重新设置:
========== Heading1 ========== Heading2 ========== Heading3 ---------- Heading4 ^^^^^^^^^^
纺织品:
h1. Heading1 h2. Heading2 h3. Heading3 h4. Heading4
文件信息
重新设置:
HelloWorld =========== :Date: Today :Author: SpamEgg :Location: Here
纺织品:
h1. HelloWorld Date: Today Author: SpamEgg Location: Here
段落
重新设置:
Normal Text
纺织品:
Normal Text
强调
重新设置:
*emphasized* (e.g., italics)
纺织品:
_emphasized_ (e.g., italics)
强烈强调
重新设置:
**strongly emphasized** (e.g., boldface)
纺织品:
*strongly emphasized* (e.g., boldface)
列表项
重新设置:
- An item in a bulleted (unordered) list - Another item in a bulleted list - Second Level * Second Level Items * Third level
纺织品:
* An item in a bulleted (unordered) list * Another item in a bulleted list ** Second Level ** Second Level Items *** Third level
枚举列表项
重新设置:
#. An item in an enumerated (ordered) list xxxxxxx #. Another item in an enumerated list yyyyyy #. Another level in an enumerated list vvvvvvvv #. Another level in an enumerated list vvvvvvvv #. 3rd element at indent level1
纺织品:
# An item in an enumerated (ordered) list xxxxxxx # Another item in an enumerated list yyyyyy ## Another level in an enumerated list vvvvvvvv ## Another level in an enumerated list vvvvvvvv # 3rd element at indent level1
引号
重新设置:
Blockquotes This text will be enclosed in an HTML blockquote element. Second Paragraph.
纺织品:
Blockquotes bq. This text will be enclosed in an HTML blockquote element. bq. Second Paragraph.
链接
重新设置:
`link text and link target url <http://www.example.com/link/target/address>`_
纺织品:
"link text and link target url":http://www.example.com/link/target/address
图像
重新设置:
.. image:: http://example.com/image.jpg .. figure:: local/image/path.png
纺织品:
!http://example.com/image.jpg! !local/image/path.png!
内部参考
重新设置:
HelloWorld =========== reference to HelloWorld_ !
纺织品:
h1. HelloWorld reference to "HelloWorld" !
文字(代码)
重新设置:
:: class Foo(object): def __init__(self, value): print "value = %d" % value raise NotImplementedError(u'EmptyClass')
纺织品:
<pre> class Foo(object): def __init__(self, value): print "value = %d" % value raise NotImplementedError(u'EmptyClass') </pre>
表格
重新设置:
+------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | ... | ... | | +------------------------+------------+----------+----------+
纺织品:
|_. Header row, column 1 (header rows optional)|_. Header 2 |_. Header 3 |_. Header 4 | | body row 1, column 1 | column 2 | column 3 | column 4 | | body row 2 | ... | ... | |
重新设置:
===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== =======
纺织品:
|_. A |_. B |_. A and B | | False | False | False | | True | False | False | | False | True | False | | True | True | True |
csv表格
重新设置:
{pr 37}$纺织品:
{pr 38}$列表
重新设置:
{pr 39}$纺织品:
{pr 38}$