-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.py
60 lines (58 loc) · 1.67 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
52
53
54
55
56
57
58
59
60
from table2ascii import table2ascii
TABLE = {
'node': 'table',
'colspec': [24, 12, 10, 10],
'rowspec': [2, 1, 1, 1, 1],
'children': [
{
'node': 'head',
'children': [
{
'node': 'row',
'children': [
{'node': 'cell', 'data': 'Header row, column 1\n(header rows optional)'},
{'node': 'cell', 'data': 'Header 2'},
{'node': 'cell', 'data': 'Header 3'},
{'node': 'cell', 'data': 'Header 4'},
]
}
]
},
{
'node': 'body',
'children': [
{
'node': 'row',
'children': [
{'node': 'cell', 'data': 'body row 1, column 1'},
{'node': 'cell', 'data': 'column 2'},
{'node': 'cell', 'data': 'column 3'},
{'node': 'cell', 'data': 'column 4'},
]
},
{
'node': 'row',
'children': [
{'node': 'cell', 'data': 'body row 2'},
{'node': 'cell', 'data': 'Cells may span columns.', 'morecols': 2},
],
},
{
'node': 'row',
'children': [
{'node': 'cell', 'data': 'body row 3'},
{'node': 'cell', 'data': 'Cells may span rows.', 'morerows': 1},
{'node': 'cell', 'data': 'Cells may span both rows and columns.', 'morerows': 1, 'morecols': 1},
],
},
{
'node': 'row',
'children': [
{'node': 'cell', 'data': 'body row 4'},
],
}
]
}
]
}
print(table2ascii(TABLE))