summaryrefslogtreecommitdiff
path: root/creole/shared
diff options
context:
space:
mode:
authorJensDiemer <git@jensdiemer.de>2020-01-18 19:32:48 +0100
committerJensDiemer <git@jensdiemer.de>2020-01-18 19:32:48 +0100
commitfffd319fa0841bc6d72e82f808b693e03443eff4 (patch)
treed216a7d816e25f27a76b0d40526be2180d029a8d /creole/shared
parentf5bc0d6b695403c5bd3905f85b34f28548513580 (diff)
downloadcreole-fffd319fa0841bc6d72e82f808b693e03443eff4.tar.gz
remove __future__ imports
Diffstat (limited to 'creole/shared')
-rw-r--r--creole/shared/HTMLParsercompat.py12
-rw-r--r--creole/shared/base_emitter.py2
-rw-r--r--creole/shared/document_tree.py4
-rw-r--r--creole/shared/example_macros.py2
-rw-r--r--creole/shared/unknown_tags.py14
-rw-r--r--creole/shared/utils.py2
6 files changed, 18 insertions, 18 deletions
diff --git a/creole/shared/HTMLParsercompat.py b/creole/shared/HTMLParsercompat.py
index 67529d8..6f61cc5 100644
--- a/creole/shared/HTMLParsercompat.py
+++ b/creole/shared/HTMLParsercompat.py
@@ -1,7 +1,7 @@
"""
Patched version of the original from:
http://hg.python.org/cpython/file/tip/Lib/html/parser.py
-
+
compare:
http://hg.python.org/cpython/file/2.7/Lib/HTMLParser.py
http://hg.python.org/cpython/file/3.2/Lib/html/parser.py
@@ -13,12 +13,12 @@ e.g.:
meld HTMLParser.py parser.py
Make it compatible with Python 2.x and 3.x
-
+
More info see html_parser.py !
"""
# ------------------------------------------------------------------- add start
-from __future__ import division, absolute_import, print_function, unicode_literals
+
from creole.py3compat import PY3
# --------------------------------------------------------------------- add end
@@ -556,7 +556,7 @@ class HTMLParser(_markupbase.ParserBase):
return self.entitydefs[s]
except KeyError:
return '&'+s+';'
-
+
return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));",
replaceEntities, s, flags=re.ASCII)
else:
@@ -584,6 +584,6 @@ class HTMLParser(_markupbase.ParserBase):
return self.entitydefs[s]
except KeyError:
return '&'+s+';'
-
+
return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)
- # -------------------------------------------------------- change end \ No newline at end of file
+ # -------------------------------------------------------- change end
diff --git a/creole/shared/base_emitter.py b/creole/shared/base_emitter.py
index 1561083..de6fd2f 100644
--- a/creole/shared/base_emitter.py
+++ b/creole/shared/base_emitter.py
@@ -10,7 +10,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
from creole.parser.html_parser_config import BLOCK_TAGS
from creole.html_tools.deentity import Deentity
diff --git a/creole/shared/document_tree.py b/creole/shared/document_tree.py
index 527e4f9..4971953 100644
--- a/creole/shared/document_tree.py
+++ b/creole/shared/document_tree.py
@@ -10,7 +10,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import warnings
import inspect
@@ -22,7 +22,7 @@ from creole.shared.utils import dict2string
class DocNode:
"""
A node in the document tree for html2creole and creole2html.
-
+
The Document tree would be created in the parser and used in the emitter.
"""
def __init__(self, kind='', parent=None, content=None, attrs=[], level=None):
diff --git a/creole/shared/example_macros.py b/creole/shared/example_macros.py
index 2eb85d8..428d5d2 100644
--- a/creole/shared/example_macros.py
+++ b/creole/shared/example_macros.py
@@ -11,7 +11,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
from xml.sax.saxutils import escape
diff --git a/creole/shared/unknown_tags.py b/creole/shared/unknown_tags.py
index 4e3e079..fe231f0 100644
--- a/creole/shared/unknown_tags.py
+++ b/creole/shared/unknown_tags.py
@@ -11,7 +11,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
from xml.sax.saxutils import escape
@@ -42,7 +42,7 @@ def _mask_content(emitter, node, mask_tag):
def raise_unknown_node(emitter, node):
"""
unknown_emit callable for Html2CreoleEmitter
-
+
Raise NotImplementedError on unknown tags.
"""
content = emitter.emit_children(node)
@@ -56,7 +56,7 @@ def raise_unknown_node(emitter, node):
def use_html_macro(emitter, node):
"""
unknown_emit callable for Html2CreoleEmitter
-
+
Use the <<html>> macro to mask unknown tags.
"""
return _mask_content(emitter, node, mask_tag="html")
@@ -65,7 +65,7 @@ def use_html_macro(emitter, node):
def preformat_unknown_nodes(emitter, node):
"""
Put unknown tags in a <pre> area.
-
+
Usefull for html2textile.emitter.TextileEmitter()
"""
return _mask_content(emitter, node, mask_tag="pre")
@@ -74,7 +74,7 @@ def preformat_unknown_nodes(emitter, node):
def escape_unknown_nodes(emitter, node):
"""
unknown_emit callable for Html2CreoleEmitter
-
+
All unknown tags should be escaped.
"""
attrs = node.get_attrs_as_string()
@@ -99,8 +99,8 @@ def escape_unknown_nodes(emitter, node):
def transparent_unknown_nodes(emitter, node):
"""
- unknown_emit callable for Html2CreoleEmitter
-
+ unknown_emit callable for Html2CreoleEmitter
+
Remove all unknown html tags and show only
their child nodes' content.
"""
diff --git a/creole/shared/utils.py b/creole/shared/utils.py
index e150c5f..f1b981d 100644
--- a/creole/shared/utils.py
+++ b/creole/shared/utils.py
@@ -9,7 +9,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import shlex
import json