org.markdownj.HTMLToken Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of markdownj-core Show documentation
Show all versions of markdownj-core Show documentation
Core functionality provided by MarkdownJ.
The newest version!
package org.markdownj;
public class HTMLToken {
private boolean isTag;
private String text;
private HTMLToken(boolean tag, String value) {
isTag = tag;
text = value;
}
public static HTMLToken tag(String text) {
return new HTMLToken(true, text);
}
public static HTMLToken text(String text) {
return new HTMLToken(false, text);
}
/**
* @return true
if this is a tag, false
if it's text.
*/
public boolean isTag() {
return isTag;
}
public String getText() {
return text;
}
@Override
public String toString() {
String type;
if (isTag()) {
type = "tag";
} else {
type = "text";
}
return type + ": " + getText();
}
}