X-Git-Url: https://projects.mako.cc/source/pyblosxom-markdown2/blobdiff_plain/eda9dfa5fda0ddc342099b8178b259d75f642ac7..a17a4b49b76ae7be5674787cddd1071dc1776e72:/markdown-plugin.py diff --git a/markdown-plugin.py b/markdown-plugin.py index 6b03ed9..3224c63 100644 --- a/markdown-plugin.py +++ b/markdown-plugin.py @@ -38,7 +38,7 @@ USA. """ PREFORMATTER_ID = 'markdown' -FILE_EXT = 'mkdn' +FILENAME_EXTENSIONS = ('txt','text','mkdn','markdown','md','mdown','markdn','mkd') _version__ = '0.2' __author__ = 'Benjamin Mako Hill ' __author__ = 'seanh' @@ -63,26 +63,17 @@ md = markdown.Markdown( ) def cb_entryparser(args): - args[FILE_EXT] = readfile + for FILENAME_EXTENSION in FILENAME_EXTENSIONS: + args[FILENAME_EXTENSION] = readfile return args def cb_preformat(args): if args['parser'] == PREFORMATTER_ID: return parse(''.join(args['story'])) -def to_ascii(char): - """Return char if char is an ASCII character, '?' otherwise.""" - if ord(char) < 128: - return char - else: - return '?' - def parse(story): - # Replace any non-ascii characters in the story with '?', so that - # python-markdown doesn't crash. - ascii = "".join([to_ascii(x) for x in story]) # Convert the ASCII text to HTML with python-markdown. - html = md.convert(ascii) + html = md.convert(story) # Reset python-markdown ready for next time. md.reset() return html