info.bliki.html.wikipedia.PreTag 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 PreTag extends OpenCloseTag {
protected static final String PRE_OPEN = "\n";
protected static final String PRE_CLOSE = "\n
\n";
protected static final String SOURCE_OPEN = "\n\n";
public PreTag() {
super(PRE_OPEN, PRE_CLOSE, false, false);
}
@Override
public void open(TagNode node, StringBuilder resultBuffer) {
resultBuffer.append(openStr);
}
@Override
public void close(TagNode node, StringBuilder resultBuffer) {
resultBuffer.append(closeStr);
}
@Override
public void content(AbstractHTMLToWiki w, TagNode node, StringBuilder resultBuffer, boolean showWithoutTag) {
Map attr = node.getAttributes();
if ("code".equals(attr.get("name"))) {
String sourceStr = SOURCE_OPEN;
setCloseStr(SOURCE_CLOSE);
if (attr.get("class").equals("html") || attr.get("class").equals("xml")) {
sourceStr = "\n