info.bliki.html.wikipedia.OpenCloseHTMLTag Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bliki-core Show documentation
Show all versions of bliki-core Show documentation
This is the core project.
The newest version!
package info.bliki.html.wikipedia;
import info.bliki.htmlcleaner.TagNode;
import java.util.Map;
public class OpenCloseHTMLTag extends OpenCloseTag {
public OpenCloseHTMLTag(String opener, String closer) {
super(opener, closer);
}
@Override
public void open(TagNode node, StringBuilder resultBuffer) {
resultBuffer.append(openStr);
Map tagAttributes = node.getAttributes();
boolean first = true;
for (Map.Entry currEntry : tagAttributes.entrySet()) {
if (first) {
resultBuffer.append(" ");
first = false;
}
String attName = currEntry.getKey();
if (attName.length() >= 1 && Character.isLetter(attName.charAt(0))) {
String attValue = currEntry.getValue();
resultBuffer.append(" " + attName + "=\"" + attValue + "\"");
}
}
resultBuffer.append(">");
}
}