aboutsummaryrefslogtreecommitdiff
path: root/mammoth/html_paths.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/html_paths.py')
-rw-r--r--mammoth/html_paths.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mammoth/html_paths.py b/mammoth/html_paths.py
index c91813a..a8fb952 100644
--- a/mammoth/html_paths.py
+++ b/mammoth/html_paths.py
@@ -7,15 +7,16 @@ def path(elements):
return HtmlPath(elements)
-def element(names, class_names=None, fresh=None, separator=None):
+def element(names, attributes=None, class_names=None, fresh=None, separator=None):
+ if attributes is None:
+ attributes = {}
if class_names is None:
class_names = []
if fresh is None:
fresh = False
if class_names:
- attributes = {"class": " ".join(class_names)}
- else:
- attributes = {}
+ attributes["class"] = " ".join(class_names)
+
return HtmlPathElement(html.tag(
tag_names=names,
attributes=attributes,
@@ -27,13 +28,13 @@ def element(names, class_names=None, fresh=None, separator=None):
@cobble.data
class HtmlPath(object):
elements = cobble.field()
-
+
def wrap(self, generate_nodes):
nodes = generate_nodes()
for element in reversed(self.elements):
nodes = element.wrap_nodes(nodes)
-
+
return nodes