forked from jedie/python-creole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.py
51 lines (31 loc) · 1.05 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# coding: utf-8
"""
simple demo
~~~~~~~~~~~
"""
from __future__ import division, absolute_import, print_function, unicode_literals
from creole import creole2html, html2creole, html2rest, html2textile
source_creole = """\
== simple demo
You can convert from:
* **creole2html**, **html2creole**, **html2rest**, //html2textile//
=== a table:
|=headline 1 |= headline 2 |
| 1.1. cell | 1.2. cell |
| 2.1. cell | 2.2. cell |
----
More info on our [[http://code.google.com/p/python-creole/|Homepage]]."""
if __name__ == "__main__":
print("_" * 79 + "\n*** Convert creole into html: ***\n\n")
html = creole2html(source_creole)
print(html)
print("\n\n" + "_" * 79 + "\n*** Convert html back into creole: ***\n\n")
creole = html2creole(html)
print(creole)
print("\n\n" + "_" * 79 + "\n*** Convert html into ReStructuredText: ***\n\n")
rest = html2rest(html)
print(rest)
print("\n\n" + "_" * 79 + "\n*** Convert html into textile: ***\n\n")
textile = html2textile(html)
print(textile)