Search in sources :

Example 1 with WikiLink

use of com.vladsch.flexmark.ext.wikilink.WikiLink in project flexmark-java by vsch.

the class WikiLinkLinkRefProcessor method updateNodeElements.

@Override
public void updateNodeElements(final Document document, final Node node) {
    assert (node instanceof WikiNode);
    final WikiNode wikiNode = (WikiNode) node;
    if (node instanceof WikiLink && WikiLinkExtension.ALLOW_INLINES.getFrom(document)) {
        // need to update link and pageRef with plain text versions
        if (wikiNode.getText().isNull()) {
            BasedSequence link = new TextCollectingVisitor().collectAndGetSequence(node);
            wikiNode.setLink(link, WikiLinkExtension.ALLOW_ANCHORS.getFrom(document), WikiLinkExtension.ALLOW_ANCHOR_ESCAPE.getFrom(document));
        }
    }
}
Also used : TextCollectingVisitor(com.vladsch.flexmark.ast.util.TextCollectingVisitor) WikiNode(com.vladsch.flexmark.ext.wikilink.WikiNode) BasedSequence(com.vladsch.flexmark.util.sequence.BasedSequence) WikiLink(com.vladsch.flexmark.ext.wikilink.WikiLink)

Aggregations

TextCollectingVisitor (com.vladsch.flexmark.ast.util.TextCollectingVisitor)1 WikiLink (com.vladsch.flexmark.ext.wikilink.WikiLink)1 WikiNode (com.vladsch.flexmark.ext.wikilink.WikiNode)1 BasedSequence (com.vladsch.flexmark.util.sequence.BasedSequence)1