diff options
author | Waylan Limberg <waylan@gmail.com> | 2013-03-15 15:07:36 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2013-03-15 15:07:36 -0400 |
commit | 7b05d336106a4d709f3f8a86e688c5d010b2cfe2 (patch) | |
tree | fa7bf6c283f0072ab4d03f51a6e8852d5e2881bf | |
parent | ed508633c6db0342b6fbec681bbce4aa11507ba9 (diff) | |
parent | da9a1bbe743bd9374ac50c251d3e7468264f680d (diff) | |
download | markdown-7b05d336106a4d709f3f8a86e688c5d010b2cfe2.tar.gz markdown-7b05d336106a4d709f3f8a86e688c5d010b2cfe2.tar.bz2 markdown-7b05d336106a4d709f3f8a86e688c5d010b2cfe2.zip |
Merge branch 'master' of https://github.com/waylan/Python-Markdown
-rw-r--r-- | markdown/extensions/def_list.py | 2 | ||||
-rw-r--r-- | markdown/odict.py | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/markdown/extensions/def_list.py b/markdown/extensions/def_list.py index cd9dc9c..872f9e2 100644 --- a/markdown/extensions/def_list.py +++ b/markdown/extensions/def_list.py @@ -95,7 +95,7 @@ class DefListIndentProcessor(ListIndentProcessor): def create_item(self, parent, block): """ Create a new dd and parse the block with it as the parent. """ - dd = markdown.etree.SubElement(parent, 'dd') + dd = etree.SubElement(parent, 'dd') self.parser.parseBlocks(dd, [block]) diff --git a/markdown/odict.py b/markdown/odict.py index 578cc76..8089ece 100644 --- a/markdown/odict.py +++ b/markdown/odict.py @@ -2,6 +2,13 @@ from __future__ import unicode_literals from __future__ import absolute_import from . import util +from copy import deepcopy + +def iteritems_compat(d): + """Return an iterator over the (key, value) pairs of a dictionary. + Copied from `six` module.""" + return iter(getattr(d, _iteritems)()) + class OrderedDict(dict): """ A dictionary that keeps its keys in the order in which they're inserted. @@ -30,7 +37,7 @@ class OrderedDict(dict): super_set(key, value) def __deepcopy__(self, memo): - return self.__class__([(key, copy.deepcopy(value, memo)) + return self.__class__([(key, deepcopy(value, memo)) for key, value in self.items()]) def __copy__(self): @@ -99,7 +106,7 @@ class OrderedDict(dict): return [self[k] for k in self.keyOrder] def update(self, dict_): - for k, v in six.iteritems(dict_): + for k, v in iteritems_compat(dict_): self[k] = v def setdefault(self, key, default): @@ -131,7 +138,7 @@ class OrderedDict(dict): Replaces the normal dict.__repr__ with a version that returns the keys in their Ordered order. """ - return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in six.iteritems(self)]) + return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in iteritems_compat(self)]) def clear(self): super(OrderedDict, self).clear() |