From 579288c5eb684dd09d1ef298929a566f40151205 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 27 Feb 2013 09:10:47 -0500 Subject: Now using universal code for Python 2 & 3. The most notable changes are the use of unicode_literals and absolute_imports. Actually, absolute_imports was the biggest deal as it gives us relative imports. For the first time extensions import markdown relative to themselves. This allows other packages to embed the markdown lib in a subdir of their project and still be able to use our extensions. --- markdown/treeprocessors.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'markdown/treeprocessors.py') diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py index b5eedbd..2df80f8 100644 --- a/markdown/treeprocessors.py +++ b/markdown/treeprocessors.py @@ -1,6 +1,8 @@ -import inlinepatterns -import util -import odict +from __future__ import unicode_literals +from __future__ import absolute_import +from . import util +from . import odict +from . import inlinepatterns def build_treeprocessors(md_instance, **kwargs): @@ -14,17 +16,11 @@ def build_treeprocessors(md_instance, **kwargs): def isString(s): """ Check if it's string """ if not isinstance(s, util.AtomicString): - return isinstance(s, basestring) + return isinstance(s, util.string_type) return False -class Processor: - def __init__(self, markdown_instance=None): - if markdown_instance: - self.markdown = markdown_instance - - -class Treeprocessor(Processor): +class Treeprocessor(util.Processor): """ Treeprocessors are run on the ElementTree object before serialization. -- cgit v1.2.3