diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 19:50:45 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 19:50:45 -0500 |
commit | 2fa73e2cb99b0816148ade6150f378993907534e (patch) | |
tree | cf7e2371881c680990157cae621f6045f5941f56 /beautifulsoup/builder/_html5lib.py | |
parent | e6320fad4cd162ab6c7dfe02be5206f5c3f8c25b (diff) | |
parent | ce3742abd4c7fe39247569e82e2b3acdd6052bb1 (diff) |
Added a registry for tree builders and made it possible to find a tree builder that has the features you want from the BeautifulSoup constructor.
Diffstat (limited to 'beautifulsoup/builder/_html5lib.py')
-rw-r--r-- | beautifulsoup/builder/_html5lib.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/beautifulsoup/builder/_html5lib.py b/beautifulsoup/builder/_html5lib.py index 020b7ea..f8a7a40 100644 --- a/beautifulsoup/builder/_html5lib.py +++ b/beautifulsoup/builder/_html5lib.py @@ -3,8 +3,9 @@ __all__ = [ ] from beautifulsoup.builder import ( - ACCURATE, + PERMISSIVE, HTML, + HTML_5, HTMLTreeBuilder, ) import html5lib @@ -20,7 +21,7 @@ from beautifulsoup.element import ( class HTML5TreeBuilder(HTMLTreeBuilder): """Use html5lib to build a tree.""" - tags = [ACCURATE, HTML] + features = ['html5lib', PERMISSIVE, HTML_5, HTML] def prepare_markup(self, markup, user_specified_encoding): # Store the user-specified encoding for use later on. @@ -55,7 +56,8 @@ class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): def __init__(self, soup, namespaceHTMLElements): self.soup = soup if namespaceHTMLElements: - warnings.warn("namespaceHTMLElements not supported yet", DataLossWarning) + warnings.warn("namespaceHTMLElements not supported yet", + DataLossWarning) super(TreeBuilderForHtml5lib, self).__init__(namespaceHTMLElements) def documentClass(self): |