summaryrefslogtreecommitdiff
path: root/creole
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
parentf5bc0d6b695403c5bd3905f85b34f28548513580 (diff)
downloadcreole-fffd319fa0841bc6d72e82f808b693e03443eff4.tar.gz
remove __future__ imports
Diffstat (limited to 'creole')
-rw-r--r--creole/__init__.py12
-rw-r--r--creole/cmdline.py10
-rw-r--r--creole/emitter/creol2html_emitter.py2
-rw-r--r--creole/emitter/html2creole_emitter.py2
-rw-r--r--creole/emitter/html2rest_emitter.py2
-rw-r--r--creole/emitter/html2textile_emitter.py2
-rw-r--r--creole/exceptions.py4
-rw-r--r--creole/html_tools/deentity.py6
-rw-r--r--creole/html_tools/strip_html.py4
-rw-r--r--creole/html_tools/text_tools.py4
-rw-r--r--creole/parser/creol2html_parser.py2
-rw-r--r--creole/parser/creol2html_rules.py10
-rw-r--r--creole/parser/html_parser.py6
-rw-r--r--creole/parser/html_parser_config.py4
-rw-r--r--creole/py3compat.py6
-rw-r--r--creole/rest_tools/clean_writer.py14
-rw-r--r--creole/rest_tools/pypi_rest2html.py2
-rw-r--r--creole/setup_utils.py2
-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
-rw-r--r--creole/tests/test_cli.py2
-rw-r--r--creole/tests/test_creole2html.py2
-rw-r--r--creole/tests/test_cross_compare_all.py2
-rw-r--r--creole/tests/test_cross_compare_creole.py38
-rw-r--r--creole/tests/test_cross_compare_rest.py2
-rw-r--r--creole/tests/test_cross_compare_textile.py2
-rw-r--r--creole/tests/test_html2creole.py18
-rw-r--r--creole/tests/test_html2rest.py48
-rw-r--r--creole/tests/test_html2textile.py12
-rw-r--r--creole/tests/test_macros.py12
-rw-r--r--creole/tests/test_rest2html.py28
-rw-r--r--creole/tests/test_setup.py2
-rw-r--r--creole/tests/test_setup_utils.py2
-rw-r--r--creole/tests/test_subprocess.py2
-rw-r--r--creole/tests/test_utils.py2
-rw-r--r--creole/tests/utils/base_unittest.py4
-rw-r--r--creole/tests/utils/unittest_subprocess.py2
-rw-r--r--creole/tests/utils/utils.py2
42 files changed, 155 insertions, 157 deletions
diff --git a/creole/__init__.py b/creole/__init__.py
index 6594f9d..f720b9f 100644
--- a/creole/__init__.py
+++ b/creole/__init__.py
@@ -7,10 +7,10 @@
:homepage:
http://code.google.com/p/python-creole/
-
+
:sourcecode:
http://github.com/jedie/python-creole
-
+
:PyPi:
http://pypi.python.org/pypi/python-creole/
@@ -18,7 +18,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import warnings
@@ -49,7 +49,7 @@ def creole2html(markup_string, debug=False,
>>> creole2html('This is **creole //markup//**!')
'<p>This is <strong>creole <i>markup</i></strong>!</p>'
-
+
Info: parser_kwargs and emitter_kwargs are deprecated
"""
assert isinstance(markup_string, TEXT_TYPE), "given markup_string must be unicode!"
@@ -130,7 +130,7 @@ def html2textile(html_string, debug=False,
):
"""
convert html code into textile markup
-
+
>>> html2textile('<p>This is <strong>textile <i>markup</i></strong>!</p>')
'This is *textile __markup__*!'
"""
@@ -157,7 +157,7 @@ def html2rest(html_string, debug=False,
):
"""
convert html code into ReStructuredText markup
-
+
>>> html2rest('<p>This is <strong>ReStructuredText</strong> <em>markup</em>!</p>')
'This is **ReStructuredText** *markup*!'
"""
diff --git a/creole/cmdline.py b/creole/cmdline.py
index 82a156e..78f4eb4 100644
--- a/creole/cmdline.py
+++ b/creole/cmdline.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 argparse
import codecs
@@ -36,7 +36,7 @@ class CreoleCLI(object):
default="utf-8",
help="Codec for read/write file (default encoding: utf-8)"
)
-
+
args = self.parser.parse_args()
sourcefile = args.sourcefile
@@ -49,7 +49,7 @@ class CreoleCLI(object):
print("Convert %r to %r with %s (codec: %s)" % (
sourcefile, destination, self.convert_func.__name__, encoding
))
-
+
with codecs.open(sourcefile, "r", encoding=encoding) as infile:
with codecs.open(destination, "w", encoding=encoding) as outfile:
content = infile.read()
@@ -63,10 +63,10 @@ def cli_creole2html():
def cli_html2creole():
CreoleCLI(html2creole)
-
+
def cli_html2rest():
CreoleCLI(html2rest)
-
+
def cli_html2textile():
CreoleCLI(html2textile)
diff --git a/creole/emitter/creol2html_emitter.py b/creole/emitter/creol2html_emitter.py
index 2879f4e..d1c6508 100644
--- a/creole/emitter/creol2html_emitter.py
+++ b/creole/emitter/creol2html_emitter.py
@@ -9,7 +9,7 @@
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import json
from xml.sax.saxutils import escape
diff --git a/creole/emitter/html2creole_emitter.py b/creole/emitter/html2creole_emitter.py
index 2e9c31c..00fd142 100644
--- a/creole/emitter/html2creole_emitter.py
+++ b/creole/emitter/html2creole_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
+
import posixpath
from creole.shared.base_emitter import BaseEmitter
diff --git a/creole/emitter/html2rest_emitter.py b/creole/emitter/html2rest_emitter.py
index 7a32872..41891fe 100644
--- a/creole/emitter/html2rest_emitter.py
+++ b/creole/emitter/html2rest_emitter.py
@@ -13,7 +13,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import posixpath
from creole.shared.base_emitter import BaseEmitter
diff --git a/creole/emitter/html2textile_emitter.py b/creole/emitter/html2textile_emitter.py
index 2263c12..e43b0df 100644
--- a/creole/emitter/html2textile_emitter.py
+++ b/creole/emitter/html2textile_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
+
import posixpath
from creole.shared.base_emitter import BaseEmitter
diff --git a/creole/exceptions.py b/creole/exceptions.py
index 44cddff..91f9042 100644
--- a/creole/exceptions.py
+++ b/creole/exceptions.py
@@ -4,12 +4,12 @@
"""
python-creole exceptions
~~~~~~~~~~~~~~~~~~~~~~~~
-
+
:copyleft: 2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
class DocutilsImportError(ImportError):
pass
diff --git a/creole/html_tools/deentity.py b/creole/html_tools/deentity.py
index 7a6ff1a..2f6104a 100644
--- a/creole/html_tools/deentity.py
+++ b/creole/html_tools/deentity.py
@@ -3,14 +3,14 @@
"""
python-creole utils
- ~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~~
:copyleft: 2008-2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import re
try:
@@ -39,7 +39,7 @@ class Deentity(object):
>>> d = Deentity()
>>> d.replace_all("-=[&nbsp;&gt;&#62;&#x3E;nice&lt;&#60;&#x3C;&nbsp;]=-")
'-=[ >>>nice<<< ]=-'
-
+
>>> d.replace_all("-=[M&uuml;hlheim]=-") # uuml - latin small letter u with diaeresis
'-=[M\\xfchlheim]=-'
diff --git a/creole/html_tools/strip_html.py b/creole/html_tools/strip_html.py
index 20b6788..10534ad 100644
--- a/creole/html_tools/strip_html.py
+++ b/creole/html_tools/strip_html.py
@@ -4,14 +4,14 @@
"""
python-creole utils
- ~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~~
:copyleft: 2008-2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import re
diff --git a/creole/html_tools/text_tools.py b/creole/html_tools/text_tools.py
index 28be3c9..5843cf6 100644
--- a/creole/html_tools/text_tools.py
+++ b/creole/html_tools/text_tools.py
@@ -4,14 +4,14 @@
"""
python-creole utils
- ~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~~
:copyleft: 2008-2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import re
diff --git a/creole/parser/creol2html_parser.py b/creole/parser/creol2html_parser.py
index ab09a35..6cec8ee 100644
--- a/creole/parser/creol2html_parser.py
+++ b/creole/parser/creol2html_parser.py
@@ -22,7 +22,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import re
diff --git a/creole/parser/creol2html_rules.py b/creole/parser/creol2html_rules.py
index 01bb08e..590661e 100644
--- a/creole/parser/creol2html_rules.py
+++ b/creole/parser/creol2html_rules.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 re
@@ -160,7 +160,7 @@ class BlockRules(object):
def __init__(self, blog_line_breaks=True):
if blog_line_breaks:
- # use blog style line breaks (every line break would be converted into <br />)
+ # use blog style line breaks (every line break would be converted into <br />)
self.text = r'(?P<text> .+ ) (?P<break> (?<!\\)$\n(?!\s*$) )?'
else:
# use wiki style line breaks, seperate lines with one space
@@ -224,11 +224,11 @@ INLINE_RULES = (
def _verify_rules(rules, flags):
"""
Simple verify the rules -> try to compile it ;)
-
+
>>> _verify_rules(INLINE_RULES, INLINE_FLAGS)
Rule test ok.
-
- >>> block_rules = BlockRules()
+
+ >>> block_rules = BlockRules()
>>> _verify_rules(block_rules.rules, block_rules.re_flags)
Rule test ok.
"""
diff --git a/creole/parser/html_parser.py b/creole/parser/html_parser.py
index fa60091..4380431 100644
--- a/creole/parser/html_parser.py
+++ b/creole/parser/html_parser.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 re
import warnings
@@ -50,7 +50,7 @@ headline_tag_re = re.compile(r"h(\d)", re.UNICODE)
class HtmlParser(HTMLParser):
"""
parse html code and create a document tree.
-
+
>>> p = HtmlParser()
>>> p.feed("<p>html <strong>code</strong></p>")
<DocNode document: None>
@@ -63,7 +63,7 @@ class HtmlParser(HTMLParser):
strong
data: 'code'
********************************************************************************
-
+
>>> p = HtmlParser()
>>> p.feed("<p>html1 <script>var foo='<em>BAR</em>';</script> html2</p>")
<DocNode document: None>
diff --git a/creole/parser/html_parser_config.py b/creole/parser/html_parser_config.py
index 9790833..ddbda8f 100644
--- a/creole/parser/html_parser_config.py
+++ b/creole/parser/html_parser_config.py
@@ -4,14 +4,14 @@
"""
python-creole
~~~~~~~~~~~~~
-
+
created by Jens Diemer
:copyleft: 2009-2011 by the python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
BLOCK_TAGS = (
"address", "blockquote", "center", "dir", "div", "dl", "fieldset",
diff --git a/creole/py3compat.py b/creole/py3compat.py
index f48da75..76c55b4 100644
--- a/creole/py3compat.py
+++ b/creole/py3compat.py
@@ -3,16 +3,16 @@
"""
Helper to support Python v2 and v3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
Some ideas borrowed from six
-
+
See also:
http://python3porting.com
https://bitbucket.org/gutworth/six/src/tip/six.py
http://packages.python.org/six/
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import sys
import doctest
diff --git a/creole/rest_tools/clean_writer.py b/creole/rest_tools/clean_writer.py
index 5378bd7..2b6ae66 100644
--- a/creole/rest_tools/clean_writer.py
+++ b/creole/rest_tools/clean_writer.py
@@ -4,19 +4,19 @@
"""
A clean reStructuredText html writer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
It will produce a minimal set of html output.
(No extry divs, classes oder ids.)
-
+
Some code stolen from:
http://www.arnebrodowski.de/blog/write-your-own-restructuredtext-writer.html
https://github.com/alex-morega/docutils-plainhtml/blob/master/plain_html_writer.py
-
+
:copyleft: 2011-2013 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
#import warnings
import sys
@@ -193,13 +193,13 @@ class CleanHTMLTranslator(html4css1.HTMLTranslator, object):
def rest2html(content, enable_exit_status=None, **kwargs):
"""
Convert reStructuredText markup to clean html code: No extra div, class or ids.
-
+
>>> rest2html("- bullet list")
'<ul>\\n<li>bullet list</li>\\n</ul>\\n'
-
+
>>> rest2html("A ReSt link to `PyLucid CMS <http://www.pylucid.org>`_ :)")
'<p>A ReSt link to <a href="http://www.pylucid.org">PyLucid CMS</a> :)</p>\\n'
-
+
>>> rest2html("========", enable_exit_status=1, traceback=False, exit_status_level=2)
Traceback (most recent call last):
...
diff --git a/creole/rest_tools/pypi_rest2html.py b/creole/rest_tools/pypi_rest2html.py
index fd7d16d..c60ae0c 100644
--- a/creole/rest_tools/pypi_rest2html.py
+++ b/creole/rest_tools/pypi_rest2html.py
@@ -11,7 +11,7 @@
https://bitbucket.org/pypa/pypi/issue/161/rest-formatting-fails-and-there-is-no-way
"""
-from __future__ import division, absolute_import, print_function
+
try:
# Python 3
diff --git a/creole/setup_utils.py b/creole/setup_utils.py
index 977cb73..6f6b651 100644
--- a/creole/setup_utils.py
+++ b/creole/setup_utils.py
@@ -42,7 +42,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import codecs
import os
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
diff --git a/creole/tests/test_cli.py b/creole/tests/test_cli.py
index 5be41d5..dc692fc 100644
--- a/creole/tests/test_cli.py
+++ b/creole/tests/test_cli.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 subprocess
import unittest
diff --git a/creole/tests/test_creole2html.py b/creole/tests/test_creole2html.py
index 4e21e13..b944ee9 100644
--- a/creole/tests/test_creole2html.py
+++ b/creole/tests/test_creole2html.py
@@ -16,7 +16,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import sys
import unittest
diff --git a/creole/tests/test_cross_compare_all.py b/creole/tests/test_cross_compare_all.py
index 58259d1..b10f59a 100644
--- a/creole/tests/test_cross_compare_all.py
+++ b/creole/tests/test_cross_compare_all.py
@@ -18,7 +18,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
diff --git a/creole/tests/test_cross_compare_creole.py b/creole/tests/test_cross_compare_creole.py
index 6431fc0..ea48603 100644
--- a/creole/tests/test_cross_compare_creole.py
+++ b/creole/tests/test_cross_compare_creole.py
@@ -4,7 +4,7 @@
"""
cross compare creole unittest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
+
Compare all similarities between:
* creole2html
* html2creole
@@ -16,7 +16,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
@@ -33,13 +33,13 @@ class CrossCompareCreoleTests(BaseCreoleTest):
**//bold italics//**
//**bold italics**//
//This is **also** good.//
-
+
Creole 1.0 optional:
This is ##monospace## text.
This is ^^superscripted^^ text.
This is ,,subscripted,, text.
This is __underlined__ text.
-
+
own additions:
This is --small-- and this ~~strikeout~~ ;)
""",
@@ -48,13 +48,13 @@ class CrossCompareCreoleTests(BaseCreoleTest):
<strong><i>bold italics</i></strong><br />
<i><strong>bold italics</strong></i><br />
<i>This is <strong>also</strong> good.</i></p>
-
+
<p>Creole 1.0 optional:<br />
This is <tt>monospace</tt> text.<br />
This is <sup>superscripted</sup> text.<br />
This is <sub>subscripted</sub> text.<br />
This is <u>underlined</u> text.</p>
-
+
<p>own additions:<br />
This is <small>small</small> and this <del>strikeout</del> ;)</p>
"""
@@ -132,7 +132,7 @@ class CrossCompareCreoleTests(BaseCreoleTest):
self.cross_compare_creole(
creole_string=r"""
=== Closing braces in nowiki:
-
+
{{{
if (x != NULL) {
for (i = 0; i < size; i++) {
@@ -143,7 +143,7 @@ class CrossCompareCreoleTests(BaseCreoleTest):
""",
html_string="""
<h3>Closing braces in nowiki:</h3>
-
+
<pre>
if (x != NULL) {
for (i = 0; i &lt; size; i++) {
@@ -156,14 +156,14 @@ class CrossCompareCreoleTests(BaseCreoleTest):
def test_pre2(self):
self.cross_compare_creole(r"""
111
-
+
{{{
//This// does **not** get [[formatted]]
}}}
222
one
-
+
{{{
foo
@@ -172,14 +172,14 @@ class CrossCompareCreoleTests(BaseCreoleTest):
two
""", """
<p>111</p>
-
+
<pre>
//This// does **not** get [[formatted]]
</pre>
<p>222</p>
-
+
<p>one</p>
-
+
<pre>
foo
@@ -191,7 +191,7 @@ class CrossCompareCreoleTests(BaseCreoleTest):
def test_pre(self):
self.cross_compare_creole(r"""
start
-
+
{{{
* no list
<html escaped>
@@ -199,7 +199,7 @@ class CrossCompareCreoleTests(BaseCreoleTest):
end
""", """
<p>start</p>
-
+
<pre>
* no list
&lt;html escaped&gt;
@@ -219,16 +219,16 @@ class CrossCompareCreoleTests(BaseCreoleTest):
self.cross_compare_creole(
creole_string=r"""
= Headline
-
+
=== **not** //parsed//
-
+
No == headline == or?
""",
html_string="""
<h1>Headline</h1>
-
+
<h3>**not** //parsed//</h3>
-
+
<p>No == headline == or?</p>
"""
)
diff --git a/creole/tests/test_cross_compare_rest.py b/creole/tests/test_cross_compare_rest.py
index c40e924..454d6e5 100644
--- a/creole/tests/test_cross_compare_rest.py
+++ b/creole/tests/test_cross_compare_rest.py
@@ -13,7 +13,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
diff --git a/creole/tests/test_cross_compare_textile.py b/creole/tests/test_cross_compare_textile.py
index 2a0681a..fbbd871 100644
--- a/creole/tests/test_cross_compare_textile.py
+++ b/creole/tests/test_cross_compare_textile.py
@@ -16,7 +16,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
diff --git a/creole/tests/test_html2creole.py b/creole/tests/test_html2creole.py
index 58a20ef..df7c951 100644
--- a/creole/tests/test_html2creole.py
+++ b/creole/tests/test_html2creole.py
@@ -5,15 +5,15 @@
"""
html2creole tests
~~~~~~~~~~~~~~~~~
-
+
special html to creole convert tests, witch can't tests in "cross compare"
-
+
:copyleft: 2008-2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
@@ -136,7 +136,7 @@ class TestHtml2CreoleMarkup(BaseCreoleTest):
)
def test_transparent_unknown_nodes2(self):
- """
+ """
HTMLParser has problems with <script> tags.
See: http://bugs.python.org/issue670664
"""
@@ -163,7 +163,7 @@ class TestHtml2CreoleMarkup(BaseCreoleTest):
""", unknown_emit=transparent_unknown_nodes
)
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def test_entities(self):
"""
@@ -224,7 +224,7 @@ class TestHtml2CreoleMarkup(BaseCreoleTest):
def test_tbody_table(self):
self.assert_html2creole(r"""
Ignore 'tbody' tag in tables:
-
+
|= Headline 1 |= Headline 2 |
| cell one | cell two |
end
@@ -327,7 +327,7 @@ class TestHtml2CreoleMarkup(BaseCreoleTest):
"""
self.assert_html2creole(r"""
**foo**
-
+
* one
""", """
<b>foo</b><ul><li>one</li></ul>
@@ -409,9 +409,9 @@ class TestHtml2CreoleMarkup(BaseCreoleTest):
def test_horizontal_rule(self):
self.assert_html2creole(r"""
one
-
+
----
-
+
two
""", """
<p>one</p>
diff --git a/creole/tests/test_html2rest.py b/creole/tests/test_html2rest.py
index 9056d54..2d391cb 100644
--- a/creole/tests/test_html2rest.py
+++ b/creole/tests/test_html2rest.py
@@ -4,7 +4,7 @@
"""
html2rest unittest
~~~~~~~~~~~~~~~~~~~~~
-
+
Unittests for special cases which only works in the html2rest way.
Note: This only works fine if there is no problematic whitespace handling.
@@ -13,7 +13,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
@@ -29,7 +29,7 @@ class ReStTests(BaseCreoleTest):
self.assert_html2rest(
rest_string="""
first block, line 1 and line 2
-
+
second block, line 1 and line 2
""",
html_string="""
@@ -75,7 +75,7 @@ class ReStTests(BaseCreoleTest):
self.assert_html2rest(
rest_string="""
::
-
+
>>> from creole import creole2html
>>> creole2html("This is **creole //markup//**")
'<p>This is <strong>creole <i>markup</i></strong></p>
@@ -117,21 +117,21 @@ class ReStTests(BaseCreoleTest):
self.assert_html2rest(
rest_string="""
A nested bullet lists:
-
+
* item 1 without p-tag
-
+
* A **`subitem 1.1 </1.1/url/>`_ link** here.
-
+
* subsubitem 1.1.1
-
+
* subsubitem 1.1.2
-
+
* subitem 1.2
-
+
* item 2 without p-tag
-
+
* subitem 2.1
-
+
Text under list.
""",
html_string="""
@@ -195,16 +195,16 @@ class ReStTests(BaseCreoleTest):
</table>
"""
)
-
+
def test_duplicate_substitution1(self):
self.assertRaises(Html2restException, self.assert_html2rest,
rest_string="""
+-----------------------------+
| this is `same`_ first time. |
+-----------------------------+
-
+
.. _same: /first/
-
+
the `same </other/>`_ link?
""",
html_string="""
@@ -216,7 +216,7 @@ class ReStTests(BaseCreoleTest):
""",
# debug=True
)
-
+
def test_duplicate_link_substitution(self):
self.assertRaises(Html2restException, self.assert_html2rest,
# self.cross_compare(
@@ -224,9 +224,9 @@ class ReStTests(BaseCreoleTest):
+-----------------------------+
| this is `same`_ first time. |
+-----------------------------+
-
+
.. _same: /first/
-
+
the `same </other/>`_ link?
""",
html_string="""
@@ -245,7 +245,7 @@ class ReStTests(BaseCreoleTest):
rest_string="""
a |image|...
and a other |image|!
-
+
.. |image| image:: /image.png
.. |image| image:: /other.png
""",
@@ -266,13 +266,13 @@ class ReStTests(BaseCreoleTest):
# rest_string="""
# 111 <<pre>><x><</pre>>foo<<pre>></x><</pre>> 222
# 333<<pre>><x foo1="bar1"><</pre>>foobar<<pre>></x><</pre>>444
-#
+#
# 555<<pre>><x /><</pre>>666
# """,
# html_string="""
# <p>111 <x>foo</x> 222<br />
# 333<x foo1="bar1">foobar</x>444</p>
-#
+#
# <p>555<x />666</p>
# """,
# emitter_kwargs={"unknown_emit":preformat_unknown_nodes}
@@ -281,7 +281,7 @@ class ReStTests(BaseCreoleTest):
# def test_transparent_unknown_nodes(self):
# """
# transparent_unknown_nodes is the default unknown_emit:
-#
+#
# Remove all unknown html tags and show only
# their child nodes' content.
# """
@@ -289,13 +289,13 @@ class ReStTests(BaseCreoleTest):
# rest_string="""
# 111 <<pre>><x><</pre>>foo<<pre>></x><</pre>> 222
# 333<<pre>><x foo1="bar1"><</pre>>foobar<<pre>></x><</pre>>444
-#
+#
# 555<<pre>><x /><</pre>>666
# """,
# html_string="""
# <p>111 <x>foo</x> 222<br />
# 333<x foo1="bar1">foobar</x>444</p>
-#
+#
# <p>555<x />666</p>
# """,
# )
diff --git a/creole/tests/test_html2textile.py b/creole/tests/test_html2textile.py
index f02fced..b26b3e9 100644
--- a/creole/tests/test_html2textile.py
+++ b/creole/tests/test_html2textile.py
@@ -4,7 +4,7 @@
"""
html2textile unittest
~~~~~~~~~~~~~~~~~~~~~
-
+
Unittests for special cases which only works in the html2textile way.
Note: This only works fine if there is no problematic whitespace handling.
@@ -13,7 +13,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
@@ -46,13 +46,13 @@ class TextileTests(BaseCreoleTest):
textile_string="""
111 <<pre>><x><</pre>>foo<<pre>></x><</pre>> 222
333<<pre>><x foo1="bar1"><</pre>>foobar<<pre>></x><</pre>>444
-
+
555<<pre>><x /><</pre>>666
""",
html_string="""
<p>111 <x>foo</x> 222<br />
333<x foo1="bar1">foobar</x>444</p>
-
+
<p>555<x />666</p>
""",
emitter_kwargs={"unknown_emit":preformat_unknown_nodes}
@@ -61,7 +61,7 @@ class TextileTests(BaseCreoleTest):
def test_transparent_unknown_nodes(self):
"""
transparent_unknown_nodes is the default unknown_emit:
-
+
Remove all unknown html tags and show only
their child nodes' content.
"""
@@ -75,7 +75,7 @@ class TextileTests(BaseCreoleTest):
html_string="""
<p>111 <x>foo</x> 222<br />
333<x foo1="bar1">foobar</x>444</p>
-
+
<p>555<x />666</p>
""",
)
diff --git a/creole/tests/test_macros.py b/creole/tests/test_macros.py
index a5194f9..2a036be 100644
--- a/creole/tests/test_macros.py
+++ b/creole/tests/test_macros.py
@@ -4,15 +4,15 @@
"""
Creole unittest macros
~~~~~~~~~~~~~~~~~~~~~~
-
+
Note: all mecro functions must return unicode!
-
+
:copyleft: 2008-2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import json
@@ -20,10 +20,10 @@ def unittest_macro1(**kwargs):
"""
>>> unittest_macro1(foo="bar")
'[test macro1 - kwargs: foo="bar"]'
-
+
>>> unittest_macro1()
'[test macro1 - kwargs: ]'
-
+
>>> unittest_macro1(a=1,b=2)
'[test macro1 - kwargs: a=1,b=2]'
"""
@@ -40,4 +40,4 @@ def unittest_macro2(char, text):
if __name__ == '__main__':
import doctest
- print(doctest.testmod()) \ No newline at end of file
+ print(doctest.testmod())
diff --git a/creole/tests/test_rest2html.py b/creole/tests/test_rest2html.py
index ea23be8..23261d9 100644
--- a/creole/tests/test_rest2html.py
+++ b/creole/tests/test_rest2html.py
@@ -4,14 +4,14 @@
"""
rest2html unittest
~~~~~~~~~~~~~~~~~~
-
+
Unittests for rest2html, see: creole/rest2html/clean_writer.py
:copyleft: 2011-2012 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import tempfile
import unittest
@@ -24,7 +24,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
self.assert_rest2html("""
:homepage:
http://code.google.com/p/python-creole/
-
+
:sourcecode:
http://github.com/jedie/python-creole
""", """
@@ -61,17 +61,17 @@ class ReSt2HtmlTests(BaseCreoleTest):
def test_clean_list(self):
self.assert_rest2html("""
* item 1
-
+
* item 1.1
-
+
* item 1.2
-
+
* item 2
-
+
numbered list:
-
+
#. item A
-
+
#. item B
""", """
<ul>
@@ -96,7 +96,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
======
head 1
======
-
+
------
head 2
------
@@ -108,7 +108,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
def test_include_disabled_by_default(self):
self.assert_rest2html("""
Include should be disabled by default.
-
+
.. include:: doesntexist.txt
""", """
<p>Include should be disabled by default.</p>
@@ -122,7 +122,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
temp.flush()
self.assert_rest2html("""
Enable include and test it.
-
+
.. include:: %s
""" % temp.name, """
<p>Enable include and test it.</p>
@@ -132,7 +132,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
def test_raw_disabled_by_default(self):
self.assert_rest2html("""
Raw directive should be disabled by default.
-
+
.. raw:: html
<hr width=50 size=10>
@@ -143,7 +143,7 @@ class ReSt2HtmlTests(BaseCreoleTest):
def test_raw_enabled(self):
self.assert_rest2html("""
Now RAW is enabled.
-
+
.. raw:: html
<hr width=50 size=10>
diff --git a/creole/tests/test_setup.py b/creole/tests/test_setup.py
index 52524dc..1019c89 100644
--- a/creole/tests/test_setup.py
+++ b/creole/tests/test_setup.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 unittest
import sys
diff --git a/creole/tests/test_setup_utils.py b/creole/tests/test_setup_utils.py
index f7b2975..3025543 100644
--- a/creole/tests/test_setup_utils.py
+++ b/creole/tests/test_setup_utils.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
+
import unittest
import os
diff --git a/creole/tests/test_subprocess.py b/creole/tests/test_subprocess.py
index 6babded..48fcd1f 100644
--- a/creole/tests/test_subprocess.py
+++ b/creole/tests/test_subprocess.py
@@ -8,7 +8,7 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import division, absolute_import, print_function, unicode_literals
+
import unittest
import sys
diff --git a/creole/tests/test_utils.py b/creole/tests/test_utils.py
index 2ad8d07..d1c2939 100644
--- a/creole/tests/test_utils.py
+++ b/creole/tests/test_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 unittest
diff --git a/creole/tests/utils/base_unittest.py b/creole/tests/utils/base_unittest.py
index f9002fa..6811006 100644
--- a/creole/tests/utils/base_unittest.py
+++ b/creole/tests/utils/base_unittest.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
+
import re
import warnings
@@ -149,7 +149,7 @@ class BaseCreoleTest(MarkupTest):
self.assertEqual(out_string, html_string, msg="creole2html")
def assert_html2creole2(self, creole, html,
- debug=False,
+ debug=False,
unknown_emit=None,
strict=False,
):
diff --git a/creole/tests/utils/unittest_subprocess.py b/creole/tests/utils/unittest_subprocess.py
index bca3779..96f271b 100644
--- a/creole/tests/utils/unittest_subprocess.py
+++ b/creole/tests/utils/unittest_subprocess.py
@@ -8,8 +8,6 @@
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
-from __future__ import print_function, unicode_literals
-
import json
import os
import subprocess
diff --git a/creole/tests/utils/utils.py b/creole/tests/utils/utils.py
index 5e2b24a..fd94da7 100644
--- a/creole/tests/utils/utils.py
+++ b/creole/tests/utils/utils.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
+
import difflib
import textwrap