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

org.commonmark.ext.front.matter.YamlFrontMatterVisitor Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
package org.commonmark.ext.front.matter;

import org.commonmark.node.AbstractVisitor;
import org.commonmark.node.CustomNode;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class YamlFrontMatterVisitor extends AbstractVisitor {
    private Map> data;

    public YamlFrontMatterVisitor() {
        data = new LinkedHashMap<>();
    }

    @Override
    public void visit(CustomNode customNode) {
        if (customNode instanceof YamlFrontMatterNode) {
            data.put(((YamlFrontMatterNode) customNode).getKey(), ((YamlFrontMatterNode) customNode).getValues());
        } else {
            super.visit(customNode);
        }
    }

    public Map> getData() {
        return data;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy