@@ -37,9 +37,9 @@ class Attribute(StringMixIn): | |||||
""" | """ | ||||
def __init__(self, name, value=None, quotes='"', pad_first=" ", | def __init__(self, name, value=None, quotes='"', pad_first=" ", | ||||
pad_before_eq="", pad_after_eq=""): | |||||
pad_before_eq="", pad_after_eq="", check_quotes=True): | |||||
super(Attribute, self).__init__() | super(Attribute, self).__init__() | ||||
if not quotes and self._value_needs_quotes(value): | |||||
if check_quotes and not quotes and self._value_needs_quotes(value): | |||||
raise ValueError("given value {0!r} requires quotes".format(value)) | raise ValueError("given value {0!r} requires quotes".format(value)) | ||||
self._name = name | self._name = name | ||||
self._value = value | self._value = value | ||||
@@ -237,7 +237,8 @@ class Builder(object): | |||||
else: | else: | ||||
name, value = self._pop(), None | name, value = self._pop(), None | ||||
return Attribute(name, value, quotes, start.pad_first, | return Attribute(name, value, quotes, start.pad_first, | ||||
start.pad_before_eq, start.pad_after_eq) | |||||
start.pad_before_eq, start.pad_after_eq, | |||||
check_quotes=False) | |||||
else: | else: | ||||
self._write(self._handle_token(token)) | self._write(self._handle_token(token)) | ||||
raise ParserError("_handle_attribute() missed a close token") | raise ParserError("_handle_attribute() missed a close token") | ||||
@@ -32,7 +32,7 @@ from setuptools import setup, find_packages, Extension | |||||
from mwparserfromhell import __version__ | from mwparserfromhell import __version__ | ||||
from mwparserfromhell.compat import py26, py3k | from mwparserfromhell.compat import py26, py3k | ||||
with open("README.rst") as fp: | |||||
with open("README.rst", **{'encoding':'utf-8'} if py3k else {}) as fp: | |||||
long_docs = fp.read() | long_docs = fp.read() | ||||
tokenizer = Extension("mwparserfromhell.parser._tokenizer", | tokenizer = Extension("mwparserfromhell.parser._tokenizer", | ||||