-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.py
43 lines (33 loc) · 928 Bytes
/
core.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
#!/usr/bin/python -i
"""
File info
"""
try:
from treebuilder import treebuilder
from treemodifier import treemodifier
from treeprinter import htmlprinter
except ImportError:
from .treebuilder import treebuilder
from .treemodifier import treemodifier
from .treeprinter import htmlprinter
def addup(**options):
### LOAD EXTENSIONS
#extensions = options.get("extension")
NotImplemented
### PRE-PROCESSING
NotImplemented
### BUILD TREE
ifile = options.get("infile")
root = treebuilder(ifile)
### POST-PROCESSING
root = treemodifier(root)
### PRINT ELEMENTTREE TO FILE
ofile = options.get("outfile")
with open(ofile, mode="w", encoding="utf-8") as file:
# import sys; file = sys.stdout # For testing
htmlprinter(file, root,
compact = options.get("pretty"),
doctype = root.get("type"),
)
if __name__ == "__main__":
addup(infile = "tests/site.add", outfile = "tests/site.html", extension =[])