@@ -1,6 +1,7 @@ | |||||
language: python | language: python | ||||
python: | python: | ||||
- "2.7" | - "2.7" | ||||
- "3.2" | |||||
- "3.3" | - "3.3" | ||||
install: python setup.py build | install: python setup.py build | ||||
script: python setup.py test -q | script: python setup.py test -q |
@@ -1,3 +1,7 @@ | |||||
v0.4 (unreleased): | |||||
- Added support for Python 3.2 (along with current support for 3.3 and 2.7). | |||||
v0.3.1 (released August 29, 2013): | v0.3.1 (released August 29, 2013): | ||||
- Fixed a parser bug involving URLs nested inside other markup. | - Fixed a parser bug involving URLs nested inside other markup. | ||||
@@ -1,6 +1,14 @@ | |||||
Changelog | Changelog | ||||
========= | ========= | ||||
v0.4 | |||||
---- | |||||
Unreleased | |||||
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3.1...develop>`__): | |||||
- Added support for Python 3.2 (along with current support for 3.3 and 2.7). | |||||
v0.3.1 | v0.3.1 | ||||
------ | ------ | ||||
@@ -31,7 +31,7 @@ from __future__ import unicode_literals | |||||
__author__ = "Ben Kurtovic" | __author__ = "Ben Kurtovic" | ||||
__copyright__ = "Copyright (C) 2012, 2013 Ben Kurtovic" | __copyright__ = "Copyright (C) 2012, 2013 Ben Kurtovic" | ||||
__license__ = "MIT License" | __license__ = "MIT License" | ||||
__version__ = "0.3.1" | |||||
__version__ = "0.4.dev" | |||||
__email__ = "ben.kurtovic@verizon.net" | __email__ = "ben.kurtovic@verizon.net" | ||||
from . import (compat, definitions, nodes, parser, smart_list, string_mixin, | from . import (compat, definitions, nodes, parser, smart_list, string_mixin, | ||||
@@ -10,7 +10,8 @@ types are meant to be imported directly from within the parser's modules. | |||||
import sys | import sys | ||||
py3k = sys.version_info[0] == 3 | |||||
py3k = sys.version_info.major == 3 | |||||
py32 = py3k and sys.version_info.minor == 2 | |||||
if py3k: | if py3k: | ||||
bytes = bytes | bytes = bytes | ||||
@@ -27,7 +27,7 @@ interface for the ``unicode`` type (``str`` on py3k) in a dynamic manner. | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
from .compat import py3k, str | |||||
from .compat import py3k, py32, str | |||||
__all__ = ["StringMixIn"] | __all__ = ["StringMixIn"] | ||||
@@ -125,7 +125,7 @@ class StringMixIn(object): | |||||
def capitalize(self): | def capitalize(self): | ||||
return self.__unicode__().capitalize() | return self.__unicode__().capitalize() | ||||
if py3k: | |||||
if py3k and not py32: | |||||
@inheritdoc | @inheritdoc | ||||
def casefold(self): | def casefold(self): | ||||
return self.__unicode__().casefold() | return self.__unicode__().casefold() | ||||
@@ -288,7 +288,7 @@ class StringMixIn(object): | |||||
def rpartition(self, sep): | def rpartition(self, sep): | ||||
return self.__unicode__().rpartition(sep) | return self.__unicode__().rpartition(sep) | ||||
if py3k: | |||||
if py3k and not py32: | |||||
@inheritdoc | @inheritdoc | ||||
def rsplit(self, sep=None, maxsplit=None): | def rsplit(self, sep=None, maxsplit=None): | ||||
kwargs = {} | kwargs = {} | ||||
@@ -310,7 +310,7 @@ class StringMixIn(object): | |||||
def rstrip(self, chars=None): | def rstrip(self, chars=None): | ||||
return self.__unicode__().rstrip(chars) | return self.__unicode__().rstrip(chars) | ||||
if py3k: | |||||
if py3k and not py32: | |||||
@inheritdoc | @inheritdoc | ||||
def split(self, sep=None, maxsplit=None): | def split(self, sep=None, maxsplit=None): | ||||
kwargs = {} | kwargs = {} | ||||
@@ -54,6 +54,7 @@ setup( | |||||
"Operating System :: OS Independent", | "Operating System :: OS Independent", | ||||
"Programming Language :: Python :: 2.7", | "Programming Language :: Python :: 2.7", | ||||
"Programming Language :: Python :: 3", | "Programming Language :: Python :: 3", | ||||
"Programming Language :: Python :: 3.2", | |||||
"Programming Language :: Python :: 3.3", | "Programming Language :: Python :: 3.3", | ||||
"Topic :: Text Processing :: Markup" | "Topic :: Text Processing :: Markup" | ||||
], | ], | ||||
@@ -25,7 +25,7 @@ from sys import getdefaultencoding | |||||
from types import GeneratorType | from types import GeneratorType | ||||
import unittest | import unittest | ||||
from mwparserfromhell.compat import bytes, py3k, str | |||||
from mwparserfromhell.compat import bytes, py3k, py32, str | |||||
from mwparserfromhell.string_mixin import StringMixIn | from mwparserfromhell.string_mixin import StringMixIn | ||||
from .compat import range | from .compat import range | ||||
@@ -52,8 +52,10 @@ class TestStringMixIn(unittest.TestCase): | |||||
"rsplit", "rstrip", "split", "splitlines", "startswith", "strip", | "rsplit", "rstrip", "split", "splitlines", "startswith", "strip", | ||||
"swapcase", "title", "translate", "upper", "zfill"] | "swapcase", "title", "translate", "upper", "zfill"] | ||||
if py3k: | if py3k: | ||||
methods.extend(["casefold", "format_map", "isidentifier", | |||||
"isprintable", "maketrans"]) | |||||
if not py32: | |||||
methods.append("casefold") | |||||
methods.extend(["format_map", "isidentifier", "isprintable", | |||||
"maketrans"]) | |||||
else: | else: | ||||
methods.append("decode") | methods.append("decode") | ||||
for meth in methods: | for meth in methods: | ||||
@@ -325,7 +327,7 @@ class TestStringMixIn(unittest.TestCase): | |||||
self.assertEqual("", str15.lower()) | self.assertEqual("", str15.lower()) | ||||
self.assertEqual("foobar", str16.lower()) | self.assertEqual("foobar", str16.lower()) | ||||
self.assertEqual("ß", str22.lower()) | self.assertEqual("ß", str22.lower()) | ||||
if py3k: | |||||
if py3k and not py32: | |||||
self.assertEqual("", str15.casefold()) | self.assertEqual("", str15.casefold()) | ||||
self.assertEqual("foobar", str16.casefold()) | self.assertEqual("foobar", str16.casefold()) | ||||
self.assertEqual("ss", str22.casefold()) | self.assertEqual("ss", str22.casefold()) | ||||
@@ -470,7 +470,7 @@ output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(t | |||||
name: unparsable_attributed | name: unparsable_attributed | ||||
label: a tag that should not be put through the normal parser; parsed attributes | label: a tag that should not be put through the normal parser; parsed attributes | ||||
input: "{{t1}}<nowiki attr=val attr2="{{val2}}">{{t2}}</nowiki>{{t3}}" | input: "{{t1}}<nowiki attr=val attr2="{{val2}}">{{t2}}</nowiki>{{t3}}" | ||||
output: [TemplateOpen(), Text(text=u't1'), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr"), TagAttrEquals(), Text(text="val"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr2"), TagAttrEquals(), TagAttrQuote(), TemplateOpen(), Text(text="val2"), TemplateClose(), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()] | |||||
output: [TemplateOpen(), Text(text="t1"), TemplateClose(), TagOpenOpen(), Text(text="nowiki"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr"), TagAttrEquals(), Text(text="val"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="attr2"), TagAttrEquals(), TagAttrQuote(), TemplateOpen(), Text(text="val2"), TemplateClose(), TagCloseOpen(padding=""), Text(text="{{t2}}"), TagOpenClose(), Text(text="nowiki"), TagCloseClose(), TemplateOpen(), Text(text="t3"), TemplateClose()] | |||||
--- | --- | ||||