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

com.bugvm.markdown.HTMLToken Maven / Gradle / Ivy

There is a newer version: 1.2.9
Show newest version
package com.bugvm.markdown;

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