Skip to content

Commit

Permalink
Merge pull request #203 from dufferzafar/master
Browse files Browse the repository at this point in the history
Add option to prevent default doctypes
  • Loading branch information
scoder committed Aug 20, 2016
2 parents a028aa9 + 9117f7e commit 24b917e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxml/parser.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,7 @@ cdef class HTMLParser(_FeedParser):
- remove_pis - discard processing instructions
- strip_cdata - replace CDATA sections by normal text content (default: True)
- compact - save memory for short text content (default: True)
- default_doctype - add a default doctype even if it is not found in the HTML (default: True)
Other keyword arguments:
Expand All @@ -1627,7 +1628,7 @@ cdef class HTMLParser(_FeedParser):
def __init__(self, *, encoding=None, remove_blank_text=False,
remove_comments=False, remove_pis=False, strip_cdata=True,
no_network=True, target=None, XMLSchema schema=None,
recover=True, compact=True):
recover=True, compact=True, default_doctype=True):
cdef int parse_options
parse_options = _HTML_DEFAULT_PARSE_OPTIONS
if remove_blank_text:
Expand All @@ -1638,6 +1639,8 @@ cdef class HTMLParser(_FeedParser):
parse_options = parse_options ^ htmlparser.HTML_PARSE_NONET
if not compact:
parse_options = parse_options ^ htmlparser.HTML_PARSE_COMPACT
if not default_doctype:
parse_options = parse_options ^ htmlparser.HTML_PARSE_NODEFDTD

_BaseParser.__init__(self, parse_options, 1, schema,
remove_comments, remove_pis, strip_cdata, True,
Expand Down

0 comments on commit 24b917e

Please sign in to comment.