From a24821057c7a55a06aee6048e14d71f3daad11a0 Mon Sep 17 00:00:00 2001 From: Riamse Date: Mon, 20 Aug 2012 19:41:18 -0700 Subject: [PATCH 1/2] Forgot to add compat.py --- mwparserfromhell/compat.py | 16 ++++++++++++++++ test.py | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 mwparserfromhell/compat.py create mode 100755 test.py diff --git a/mwparserfromhell/compat.py b/mwparserfromhell/compat.py new file mode 100755 index 0000000..8b3b611 --- /dev/null +++ b/mwparserfromhell/compat.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +import sys + +v = sys.version_info[0] + +if v >= 3: + bytes = bytes + str = str + basestring = (str, bytes) + import html.entities as htmlentitydefs +else: + bytes = str + str = unicode + basestring = basestring + import htmlentitydefs \ No newline at end of file diff --git a/test.py b/test.py new file mode 100755 index 0000000..e578b17 --- /dev/null +++ b/test.py @@ -0,0 +1,14 @@ +import mwparserfromhell +text = "foo {{spam|eggs}} bar" +code = mwparserfromhell.parse(text) +template = code.filter_templates()[0] +template.name +template.params +template.params[0].value +template.params[0].name +template.params[0].showkey +template.params[0].showkey = True +template.params[0].name = "apples" +code +template.add("pears", "{{plums}}") +code.filter_templates(recursive=True) From c4fd7b7468d11c3855d4c1e4aa0b7054a0a84f6f Mon Sep 17 00:00:00 2001 From: Riamse Date: Mon, 20 Aug 2012 19:45:23 -0700 Subject: [PATCH 2/2] Remove test.py - unintentionally added --- test.py | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100755 test.py diff --git a/test.py b/test.py deleted file mode 100755 index e578b17..0000000 --- a/test.py +++ /dev/null @@ -1,14 +0,0 @@ -import mwparserfromhell -text = "foo {{spam|eggs}} bar" -code = mwparserfromhell.parse(text) -template = code.filter_templates()[0] -template.name -template.params -template.params[0].value -template.params[0].name -template.params[0].showkey -template.params[0].showkey = True -template.params[0].name = "apples" -code -template.add("pears", "{{plums}}") -code.filter_templates(recursive=True)