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

org.markdownj.HTMLToken Maven / Gradle / Ivy

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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy