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
      • 文字:``一些代码`
  • 斯芬克斯纺织建筑商(实验)。
    1. 写入conf.pyextensions=['docutils\u textile']
    2. 由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

限制

待办事项

  • 文档
  • 实现一些纺织格式。

更改

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,emstrong,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.

图像

重新设置:

.. 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}$

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java需要设置框架。可设置大小(false)以重新绘制()   java我对PDF文件感到困惑   为什么是太阳。jvm。热点。调试器。DebuggerException:无法打开二进制文件`?   设置结果为textview时出现java空指针异常   我应该使用什么同步原语在Java中实现事件驱动程序框架?   java为什么WindowClosing处理程序在退出程序之前不执行后台任务?   如何将“20170712T18:43:04.000Z”转换为安卓或java中的相对时间?   Java,获取按键的时间长度,currentTimeMillies()始终为24   maven构建的java可执行Jar找不到logback。xml   java在其外部的函数中使用for循环中的值   java如何以表格格式将不同长度的数据对齐   java Play 2.5 WebSocket连接构建   maven而非eclipse的java强制转换问题   java如何在JFreeChart中使X轴上的值水平?   构建Java Windows应用程序以访问在线MySQL数据库需要什么   java添加构造函数会出错吗?这没有道理,请帮忙,编程问题   java在一个jframe中的两个JPanel中使用两个绘制方法   java数学或逻辑问题   java如何复制Androids库存摄像头方向更改