Package com.vladsch.flexmark.formatter
Class NodeRepositoryFormatter<R extends com.vladsch.flexmark.util.ast.NodeRepository<B>,B extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferenceNode<R,B,N>,N extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferencingNode<R,B>>
- java.lang.Object
-
- com.vladsch.flexmark.formatter.NodeRepositoryFormatter<R,B,N>
-
- All Implemented Interfaces:
NodeFormatter
,PhasedNodeFormatter
public abstract class NodeRepositoryFormatter<R extends com.vladsch.flexmark.util.ast.NodeRepository<B>,B extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferenceNode<R,B,N>,N extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferencingNode<R,B>> extends Object implements PhasedNodeFormatter
-
-
Field Summary
Fields Modifier and Type Field Description static HashSet<FormattingPhase>
FORMATTING_PHASES
protected B
lastReference
protected Comparator<B>
myComparator
protected boolean
recheckUndefinedReferences
protected List<B>
referenceList
protected R
referenceRepository
protected Map<String,String>
referenceUniqificationMap
protected boolean
repositoryNodesDone
protected HashSet<com.vladsch.flexmark.util.ast.Node>
unusedReferences
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @Nullable Set<FormattingPhase>
getFormattingPhases()
Comparator<B>
getReferenceComparator()
abstract com.vladsch.flexmark.util.format.options.ElementPlacement
getReferencePlacement()
abstract com.vladsch.flexmark.util.format.options.ElementPlacementSort
getReferenceSort()
abstract R
getRepository(com.vladsch.flexmark.util.data.DataHolder options)
protected com.vladsch.flexmark.util.format.options.ElementPlacement
getTranslationReferencePlacement(NodeFormatterContext context)
protected boolean
makeReferencesUnique()
Whether references should be made uniqueString
modifyTransformedReference(String transformedReferenceId, NodeFormatterContext context)
void
renderDocument(@NotNull NodeFormatterContext context, @NotNull MarkdownWriter markdown, @NotNull com.vladsch.flexmark.util.ast.Document document, @NotNull FormattingPhase phase)
Render the specified node.protected void
renderReference(B node, NodeFormatterContext context, MarkdownWriter markdown)
protected abstract void
renderReferenceBlock(B node, NodeFormatterContext context, MarkdownWriter markdown)
protected String
transformReferenceId(String nodeText, NodeFormatterContext context)
protected void
uniquifyIds(NodeFormatterContext context, MarkdownWriter markdown, com.vladsch.flexmark.util.ast.Document document)
Compute needed id map to make reference ids unique across documents[] up to entry equal to document and store this map in document property so that it can be retrieved from the document later when computing the map by documents after this document in the list.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.formatter.NodeFormatter
getBlockQuoteLikePrefixChar, getNodeClasses, getNodeFormattingHandlers
-
-
-
-
Field Detail
-
FORMATTING_PHASES
public static final HashSet<FormattingPhase> FORMATTING_PHASES
-
referenceRepository
protected final R extends com.vladsch.flexmark.util.ast.NodeRepository<B> referenceRepository
-
referenceList
protected final List<B extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferenceNode<R,B,N>> referenceList
-
unusedReferences
protected final HashSet<com.vladsch.flexmark.util.ast.Node> unusedReferences
-
lastReference
protected final B extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferenceNode<R,B,N> lastReference
-
recheckUndefinedReferences
protected boolean recheckUndefinedReferences
-
repositoryNodesDone
protected boolean repositoryNodesDone
-
myComparator
protected final Comparator<B extends com.vladsch.flexmark.util.ast.Node & com.vladsch.flexmark.util.ast.ReferenceNode<R,B,N>> myComparator
-
-
Method Detail
-
getReferenceComparator
public Comparator<B> getReferenceComparator()
-
getRepository
public abstract R getRepository(com.vladsch.flexmark.util.data.DataHolder options)
-
getReferencePlacement
public abstract com.vladsch.flexmark.util.format.options.ElementPlacement getReferencePlacement()
-
getReferenceSort
public abstract com.vladsch.flexmark.util.format.options.ElementPlacementSort getReferenceSort()
-
renderReferenceBlock
protected abstract void renderReferenceBlock(B node, NodeFormatterContext context, MarkdownWriter markdown)
-
makeReferencesUnique
protected boolean makeReferencesUnique()
Whether references should be made unique- Returns:
- true if yes, false if leave all references as is
-
getTranslationReferencePlacement
protected com.vladsch.flexmark.util.format.options.ElementPlacement getTranslationReferencePlacement(NodeFormatterContext context)
-
modifyTransformedReference
public String modifyTransformedReference(String transformedReferenceId, NodeFormatterContext context)
-
transformReferenceId
protected String transformReferenceId(String nodeText, NodeFormatterContext context)
-
getFormattingPhases
@Nullable public @Nullable Set<FormattingPhase> getFormattingPhases()
- Specified by:
getFormattingPhases
in interfacePhasedNodeFormatter
-
renderDocument
public void renderDocument(@NotNull @NotNull NodeFormatterContext context, @NotNull @NotNull MarkdownWriter markdown, @NotNull @NotNull com.vladsch.flexmark.util.ast.Document document, @NotNull @NotNull FormattingPhase phase)
Description copied from interface:PhasedNodeFormatter
Render the specified node.- Specified by:
renderDocument
in interfacePhasedNodeFormatter
- Parameters:
context
- node renderer context instancemarkdown
- markdown writer instancedocument
- the document node to renderphase
- rendering phase for which to generate the output. Will be any ofFormattingPhase
exceptFormattingPhase.DOCUMENT
because this phase is used for the non-phased node rendering
-
renderReference
protected void renderReference(B node, NodeFormatterContext context, MarkdownWriter markdown)
-
uniquifyIds
protected void uniquifyIds(NodeFormatterContext context, MarkdownWriter markdown, com.vladsch.flexmark.util.ast.Document document)
Compute needed id map to make reference ids unique across documents[] up to entry equal to document and store this map in document property so that it can be retrieved from the document later when computing the map by documents after this document in the list.- Parameters:
context
-markdown
-document
-
-
-