-
-def parse(story):
- html = md.convert(story)
- md.reset()
- return html
-
-def readfile(filename, request):
- entryData = {}
- lines = codecs.open(filename, mode="r", encoding="utf8").readlines()
- title = lines.pop(0).strip()
- while lines and lines[0].startswith("#"):
- meta = lines.pop(0)
- meta = meta[1:].strip()
- meta = meta.split(" ", 1)
- entryData[meta[0].strip()] = meta[1].strip()
- entryData['title'] = title
- entryData['body'] = parse(''.join(lines))
- # Call the postformat callbacks
- tools.run_callback('postformat',
- {'request': request,
- 'entry_data': entryData})
- return entryData