commit 4d4da972e4a8a39f16fab4e10a610a5fdd622a0d
parent e6dc33b4701f4d8d5e19bf3e8c4b42da2a7f6be1
Author: Dan Callaghan <djc@djc.id.au>
Date: Sun, 8 Jun 2008 15:11:31 +1000
return real chars instead of entities
committer: Dan Callaghan <djc@djc.id.au>
--HG--
extra : convert_revision : fde0e949d5a4e5295a9f5d4f2f16ef6812811a7e
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/mdx_typography.py b/mdx_typography.py
@@ -1,4 +1,6 @@
+# vim:encoding=utf-8
+
# from Joachim Schipper <joachim@joachimschipper.nl>
# XXX license?
@@ -47,7 +49,7 @@ class TypographyPattern(markdown.Pattern):
for p, r in self.replace:
if p.match(matched):
- return doc.createEntityReference(r)
+ return r
assert(('Configuration error: %s, matched by %s, must be matched by any of %s' % (matched, self.compiled_re.pattern, [p[0].pattern for p in self.replace])) == True)
@@ -142,15 +144,15 @@ def makeExtension(config=[]):
config = {}
if not config.has_key('rules'):
config['rules'] = [(r'(---?|\.\.\.)', # apply rule to this
- (('---', 'mdash'), # (regex, entity)
- ('--', 'ndash'),
- ('\.\.\.', '#8230'))),# end of rule
+ (('---', u'—'), # (regex, entity)
+ ('--', u'–'),
+ ('\.\.\.', u'…'))),# end of rule
(r"\B(\"|''?)\b",
- (("\"|''", 'ldquo'),
- ("'", 'lsquo'))),
+ (("\"|''", u'“'),
+ ("'", u'‘'))),
(r"(?:\b|(?<=[,.!?]))(\"|''?)",
- (("\"|''", 'rdquo'),
- ("'", 'rsquo')))]
+ (("\"|''", u'”'),
+ ("'", u'’')))]
if not config.has_key('no_widows'):
config['no_widows'] = False
if not config.has_key('caps_re'):