summaryrefslogtreecommitdiff
path: root/beautifulsoup/builder/html5lib_builder.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-18 09:56:43 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-18 09:56:43 -0500
commitd9462ef1b2760ccb6273903abcd7d253445716a4 (patch)
treec6772c648933ad1477dc642aa598f34508870fff /beautifulsoup/builder/html5lib_builder.py
parentde5a4f116b14d61da2698036cbf426a83b1b2cac (diff)
Yay, meta tag rewrites now work with html5lib.
Diffstat (limited to 'beautifulsoup/builder/html5lib_builder.py')
-rw-r--r--beautifulsoup/builder/html5lib_builder.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/beautifulsoup/builder/html5lib_builder.py b/beautifulsoup/builder/html5lib_builder.py
index 736889f..dc95493 100644
--- a/beautifulsoup/builder/html5lib_builder.py
+++ b/beautifulsoup/builder/html5lib_builder.py
@@ -130,12 +130,19 @@ class Element(html5lib.treebuilders._base.Node):
return AttrList(self.element)
def setAttributes(self, attributes):
- if attributes:
+ if attributes is not None and attributes != {}:
for name, value in attributes.items():
self.element[name] = value
-
+ # The attributes may contain variables that need substitution.
+ # Call set_up_substitutions manually.
+ # The Tag constructor calls this method automatically,
+ # but html5lib creates a Tag object before setting up
+ # the attributes.
+ self.element.contains_substitutions = (
+ self.soup.builder.set_up_substitutions(
+ self.element))
attributes = property(getAttributes, setAttributes)
-
+
def insertText(self, data, insertBefore=None):
text = TextNode(NavigableString(data), self.soup)
if insertBefore: