This Python library converts an OpenITI mARkdown document and returns a TEI-XML string based on the OpenITI TEI Schema.
Set up a virtual environment with venv
python3 -m venv .env
Activate the virtual environment
source .env/bin/activate
Install
python setup.py install
import oitei
md = open("markdown.md", "r").read()
md.close()
tei_string = oitei.convert(md).tostring() # or just cast to string with str()
with open('tei.xml', 'w') as writer:
writer.write(tei_string)
This converter is based on the OpenITI mARkdown Parser, which covers the mARkdown specification.
The most common structures are currently converted to TEI, but other less common ones are still missing:
- MorphologicalPattern
- OpenTagAuto
- OpenTagUser
- RouteDist
- RouteFrom
- RouteTowa
There are also plans to convert to TEI YAML metadata provided with mARkdown files in the OpenITI corpus.