Get rid of the to_ascii function that was stripping non-ascii characters
[pyblosxom-markdown2] / markdown-plugin.py
index 09343f832936a7c2c65bd163875ad3c81b4bbc2e..522823d843b7cfeaa854e75172e567c102093570 100644 (file)
@@ -1,13 +1,13 @@
 #!/usr/bin/env python
 """
-markdown-plugin.py -- A python-markdown 2 plugin for pyblosxom.
+markdown-plugin.py -- A Python-Markdown v2.x plugin for PyBlosxom.
 
-This plugin requires python-markdown 2, which you can download from:
+This plugin requires Python-Markdown v2.x, which you can download from:
 
     http://www.freewisdom.org/projects/python-markdown/
 
-Extract python-markdown 2 into your pyblosxom plugins dir alongside this plugin.
-Your plugins dir should look like this:
+Extract python-markdown into your pyblosxom plugins dir alongside this
+plugin. Your plugins dir should look like this:
 
     plugins/ <-- your pyblosxom plugins dir
         markdown-plugin.py <-- this file
@@ -15,8 +15,9 @@ Your plugins dir should look like this:
         markdown/ <-- directory containing python-markdown's files
         ... <-- (any other pyblosxom plugins)
 
-Now any posts with filenames ending in `.mkdn` will be passed through python-markdown.
-   
+Now any posts with filenames ending in `.mkdn` will be passed through
+python-markdown.
+
 Copyright (C) Benjamin Mako Hill, 2005
 Updated for python-markdown 2 by seanh 2009
 
@@ -57,7 +58,7 @@ md = markdown.Markdown(
                  #'meta',
                  #'rss',
                  'toc',
-                 #'wikilinks'               
+                 #'wikilinks'
                ]
 )
 
@@ -69,19 +70,9 @@ 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])
+def parse(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

Benjamin Mako Hill || Want to submit a patch?