From 22b699c4351a3eadc92b3ffb690b64a7ab903f1f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 14 Feb 2016 12:43:24 +0000 Subject: Add attributes to self closing element --- .../org/zwobble/mammoth/html/HtmlSelfClosingElement.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java') diff --git a/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java b/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java index f3ef3f8..73f4734 100644 --- a/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java +++ b/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java @@ -1,16 +1,20 @@ package org.zwobble.mammoth.html; +import java.util.Map; + public class HtmlSelfClosingElement implements HtmlNode { private final String tagName; + private final Map attributes; - public HtmlSelfClosingElement(String tagName) { + public HtmlSelfClosingElement(String tagName, Map attributes) { this.tagName = tagName; + this.attributes = attributes; } @Override public void write(StringBuilder builder) { - builder.append("<") - .append(tagName) - .append(" />"); + builder.append("<").append(tagName); + HtmlWriter.generateAttributes(attributes, builder); + builder.append(" />"); } } -- cgit v1.2.3