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

com.github.dennisit.vplus.data.support.markdown.MarkdownEntity Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package com.github.dennisit.vplus.data.support.markdown;

import lombok.Data;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Data
public class MarkdownEntity {

    public static String TAG_WIDTH = "";

    // css 样式
    private String css;

    // 最外网的div标签, 可以用来设置样式,宽高,字体等
    private Map divStyle = new ConcurrentHashMap<>();

    // 转换后的html文档
    private String html;

    public MarkdownEntity() {
    }

    public MarkdownEntity(String html) {
        this.html = html;
    }

    @Override
    public String toString() {
        return css + "\n
\n" + html + "\n
"; } private String parseDiv() { StringBuilder builder = new StringBuilder(); for (Map.Entry entry : divStyle.entrySet()) { builder.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\" "); } return builder.toString(); } public void addDivStyle(String attrKey, String value) { if (divStyle.containsKey(attrKey)) { divStyle.put(attrKey, divStyle.get(attrKey) + " " + value); } else { divStyle.put(attrKey, value); } } public void addWidthCss(String tag) { String wcss = String.format(TAG_WIDTH, tag); css += wcss; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy