-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdemo.py
50 lines (32 loc) · 1.12 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
#!/usr/bin/env python3
"""
simple demo
~~~~~~~~~~~
"""
from creole import creole2html, html2creole, html2markdown, html2rest, html2textile
source_creole = """\
== simple demo
You can convert from:
* **creole2html**, **html2creole**, **html2rest**, **html2markdown**, //html2textile//
=== a table:
|=headline 1 |= headline 2 |
| 1.1. cell | 1.2. cell |
| 2.1. cell | 2.2. cell |
----
More info on our [[https://github.com/jedie/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)
print("\n\n" + "_" * 79 + "\n*** Convert html into markdown: ***\n\n")
markdown = html2markdown(html)
print(markdown)