cmlenz@107: #!/usr/bin/python cmlenz@107: # -*- coding: utf-8 -*- cmlenz@107: cmlenz@107: import os cmlenz@107: cmlenz@107: from markup.input import HTMLParser cmlenz@107: from markup.template import Context, TemplateLoader cmlenz@107: cmlenz@107: def run(): cmlenz@107: basepath = os.path.dirname(os.path.abspath(__file__)) cmlenz@107: loader = TemplateLoader([basepath]) cmlenz@107: html_filename = os.path.join(basepath, 'index.html') cmlenz@107: html_fileobj = open(html_filename) cmlenz@107: try: cmlenz@107: html = HTMLParser(html_fileobj, html_filename) cmlenz@107: tmpl = loader.load('template.xml') cmlenz@107: print tmpl.generate(Context(input=html)).render('xhtml') cmlenz@107: finally: cmlenz@107: html_fileobj.close() cmlenz@107: cmlenz@107: cmlenz@107: if __name__ == '__main__': cmlenz@107: run()