eorg/examples/html-plain/example.py

25 lines
495 B
Python
Executable File

import os
from eorg.parser import parse
doc=[]
with open(os.path.abspath('../../tests/fixtures/test.org'), 'r') as fp:
doc = parse(fp)
builddoc ={
"TITLE": "h1",
"EMAIL": "h1",
"AUTHOR": "h1",
"HEADER1": "h1",
"HEADER2": "h2",
"HEADER3": "h3",
"SRC_BEGIN": "pre",
"COMMENT": "pre",
}
with open('test.html', 'w') as fp:
for item in doc:
print(item)
tag = builddoc[item.token]
fp.write('<%s>%s<%s/>\n' % (tag, item.value, tag))