def main(file): doc = Document(file) input = open(file).read() border = re.compile('^-{20,}$', re.MULTILINE) if re.search(border, input): intro, text = re.split(border, input, 1) else: intro, text = "", input doc.init(intro) try: doc.render(text) except PressError as e: e.report() doc.save()