aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/inlinepatterns.py6
-rwxr-xr-xtest-markdown.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 5030170..d666d6d 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -44,7 +44,11 @@ So, we apply the expressions in the following order:
import markdown
import re
from urlparse import urlparse, urlunparse
-import htmlentitydefs
+import sys
+if sys.version >= "3.0":
+ from html import entities as htmlentitydefs
+else:
+ import htmlentitydefs
"""
The actual regular expressions for patterns
diff --git a/test-markdown.py b/test-markdown.py
index 3d9ef66..d2548a0 100755
--- a/test-markdown.py
+++ b/test-markdown.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import os, difflib, time, gc, codecs, platform
+import os, difflib, time, gc, codecs, platform, sys
from pprint import pprint
import textwrap
@@ -306,7 +306,9 @@ def testDirectory(dir, measure_time=False, safe_mode=False) :
htmlDiffFile.write("</table>")
- htmlDiffFile.write(diffsBuffer.decode("utf8"))
+ if sys.version < "3.0":
+ htmlDiffFile.write(diffsBuffer.decode("utf8"))
+
htmlDiffFile.write(FOOTER)
htmlDiffFile.close()
print "Diff written to %s" % htmlDiffFilePath