Update HtmlBuilder5.java
This commit is contained in:
parent
67b719e277
commit
c919a718e9
@ -27,9 +27,18 @@ public class HtmlBuilder5 {
|
||||
|
||||
// Start tag
|
||||
html.append("<").append(tag);
|
||||
String clazz = getString(node, "class", "");
|
||||
if (!clazz.isEmpty()) {
|
||||
html.append(" class=\"").append(clazz).append("\"");
|
||||
// String clazz = getString(node, "class", "");
|
||||
// if (!clazz.isEmpty()) {
|
||||
// html.append(" class=\"").append(clazz).append("\"");
|
||||
// }
|
||||
//
|
||||
// <div class="newsletter-2-wrapper">
|
||||
// Common attributes handling
|
||||
List<String> commonAttributes = java.util.Arrays.asList("class", "id", "type", "placeholder", "href", "src",
|
||||
"alt", "title", "target", "name", "value");
|
||||
|
||||
for (String attr : commonAttributes) {
|
||||
appendAttribute(html, node, attr);
|
||||
}
|
||||
html.append(">");
|
||||
|
||||
@ -39,12 +48,6 @@ public class HtmlBuilder5 {
|
||||
html.append(text);
|
||||
}
|
||||
|
||||
// placehoder content
|
||||
// String placeholder = getString(node, "placeholder", "");
|
||||
// if (!placeholder.isEmpty()) {
|
||||
// html.append(" placeholder=\"").append(clazz).append("\"");
|
||||
// }
|
||||
|
||||
// Single icon
|
||||
Object iconObj = node.get("icon");
|
||||
if (iconObj instanceof String) {
|
||||
@ -117,6 +120,14 @@ public class HtmlBuilder5 {
|
||||
return html.toString();
|
||||
}
|
||||
|
||||
private static void appendAttribute(StringBuilder html, Map<String, Object> node, String attr) {
|
||||
String val = getString(node, attr, "");
|
||||
if (!val.isEmpty()) {
|
||||
html.append(" ").append(attr).append("=\"").append(val).append("\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String getIconEmoji(String label) {
|
||||
label = label.toLowerCase();
|
||||
if (label.contains("facebook"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user