aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/extensions/abbr.py4
-rw-r--r--tests/test_extensions.py9
2 files changed, 11 insertions, 2 deletions
diff --git a/markdown/extensions/abbr.py b/markdown/extensions/abbr.py
index 5e46f1d..3f8a443 100644
--- a/markdown/extensions/abbr.py
+++ b/markdown/extensions/abbr.py
@@ -28,7 +28,7 @@ from __future__ import unicode_literals
from . import Extension
from ..preprocessors import Preprocessor
from ..inlinepatterns import Pattern
-from ..util import etree
+from ..util import etree, AtomicString
import re
# Global Vars
@@ -88,7 +88,7 @@ class AbbrPattern(Pattern):
def handleMatch(self, m):
abbr = etree.Element('abbr')
- abbr.text = m.group('abbr')
+ abbr.text = AtomicString(m.group('abbr'))
abbr.set('title', self.title)
return abbr
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index cb27a30..cce2adf 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -27,6 +27,15 @@ class TestAbbr(unittest.TestCase):
'and a <abbr title="Abbreviation Reference">REF</abbr>. Ignore '
'REFERENCE and ref.</p>')
+ def testNestedAbbr(self):
+ """ Test Nested Abbreviations. """
+ text = '[ABBR](/foo) and _ABBR_\n\n' + \
+ '*[ABBR]: Abreviation'
+ self.assertEqual(self.md.convert(text),
+ '<p><a href="/foo"><abbr title="Abreviation">ABBR</abbr></a> '
+ 'and <em><abbr title="Abreviation">ABBR</abbr></em></p>')
+
+
class TestCodeHilite(unittest.TestCase):
""" Test codehilite extension. """