001package org.apache.wiki.markdown.extensions.jspwikilinks.postprocessor; 002 003import com.vladsch.flexmark.util.ast.Node; 004import com.vladsch.flexmark.util.ast.NodeTracker; 005import com.vladsch.flexmark.util.sequence.CharSubSequence; 006import org.apache.wiki.api.core.Context; 007import org.apache.wiki.api.core.ContextEnum; 008import org.apache.wiki.markdown.nodes.JSPWikiLink; 009 010 011/** 012 * {@link NodePostProcessorState} which further post processes local footnote links. 013 */ 014public class LocalFootnoteLinkNodePostProcessorState implements NodePostProcessorState< JSPWikiLink > { 015 016 final Context wikiContext; 017 018 public LocalFootnoteLinkNodePostProcessorState( final Context wikiContext ) { 019 this.wikiContext = wikiContext; 020 } 021 022 /** 023 * {@inheritDoc} 024 * 025 * @see NodePostProcessorState#process(NodeTracker, Node) 026 */ 027 @Override 028 public void process( final NodeTracker state, final JSPWikiLink link ) { 029 link.setUrl( CharSubSequence.of( wikiContext.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), link.getUrl().toString() ) ) ); 030 } 031 032}