All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.bliki.html.wikipedia.PreTag Maven / Gradle / Ivy

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"; protected static final String SOURCE_CLOSE = "\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"; } else if (attr.get("class").equals("java")) { sourceStr = "\n"; } else if (attr.get("class").equals("javascript")) { sourceStr = "\n"; } setOpenStr(sourceStr); } super.content(w, node, resultBuffer, showWithoutTag); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy