Skip to content

Commit 21bf1ad

Browse files
committed
Add patch from issue 150 by fantasai
--HG-- branch : csswg-testsuite
1 parent 959db30 commit 21bf1ad

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

html5lib/serializer/htmlserializer.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,44 @@ class HTMLSerializer(object):
9595
"escape_rcdata", "resolve_entities", "sanitize")
9696

9797
def __init__(self, **kwargs):
98+
"""Initialize HTMLSerializer.
99+
100+
Keyword options (default given first unless specified) include:
101+
102+
inject_meta_charset=True|False
103+
..?
104+
quote_attr_values=True|False
105+
Whether to quote attribute values that don't require quoting
106+
per HTML5 parsing rules.
107+
quote_char=u'"'|u"'"
108+
Use given quote character for attribute quoting. Default is to
109+
use double quote unless attribute value contains a double quote,
110+
in which case single quotes are used instead.
111+
escape_lt_in_attrs=False|True
112+
Whether to escape < in attribute values.
113+
escape_rc_data=False|True
114+
..?
115+
resolve_entities=True|False
116+
Whether to resolve named character entities that appear in the
117+
source tree. The XML predified entities &lt; &gt; &amp; &quot; &apos;
118+
are unaffected by this setting.
119+
strip_whitespace=False|True
120+
..?
121+
minimize_boolean_attributes=True|false
122+
Shortens boolean attributes to give just the attribute value,
123+
for example <input disabled="disabled"> becomes <input disabled>.
124+
use_trailing_solidus
125+
Includes a close-tag slash at the end of the start tag of void
126+
elements (empty elements whose end tag is forbidden). E.g. <hr/>.
127+
space_before_trailing_solidus
128+
Places a space immediately before the closing slash in a tag
129+
using a trailing solidus. E.g. <hr />. Requires use_trailing_solidus.
130+
sanitize
131+
Strip all unsafe or unknown constructs from output.
132+
See `html5lib user documentation`_
133+
134+
.. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation
135+
"""
98136
if kwargs.has_key('quote_char'):
99137
self.use_best_quote_char = False
100138
for attr in self.options:

0 commit comments

Comments
 (0)