Class NodeRepositoryFormatter<R extends NodeRepository<B>, B extends Node & ReferenceNode<R,B,N> , N extends Node & ReferencingNode<R,B> >
java.lang.Object
com.vladsch.flexmark.formatter.NodeRepositoryFormatter<R,B,N>
- All Implemented Interfaces:
NodeFormatter, PhasedNodeFormatter
- Direct Known Subclasses:
AbbreviationNodeFormatter, CoreNodeFormatter, EnumeratedReferenceNodeFormatter, FootnoteNodeFormatter, MacrosNodeFormatter
public abstract class NodeRepositoryFormatter<R extends NodeRepository<B>, B extends Node & ReferenceNode<R,B,N>, N extends Node & ReferencingNode<R,B>>
extends Object
implements PhasedNodeFormatter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HashSet<FormattingPhase> protected final Bprotected final Comparator<B> protected booleanprotected final Rprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionNodeRepositoryFormatter(DataHolder options, DataKey<Map<String, String>> referenceMapKey, DataKey<Map<String, String>> uniquificationMapKey) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidformatReferences(NodeFormatterContext context, MarkdownWriter markdown) @Nullable Set<FormattingPhase> abstract ElementPlacementabstract ElementPlacementSortabstract RgetRepository(DataHolder options) protected ElementPlacementprotected booleanWhether references should be made uniquemodifyTransformedReference(String transformedReferenceId, NodeFormatterContext context) voidrenderDocument(@NotNull NodeFormatterContext context, @NotNull MarkdownWriter markdown, @NotNull Document document, @NotNull FormattingPhase phase) Render the specified node.protected voidrenderReference(B node, NodeFormatterContext context, MarkdownWriter markdown) protected abstract voidrenderReferenceBlock(B node, NodeFormatterContext context, MarkdownWriter markdown) private voidrenderReferenceBlockUnique(B node, NodeFormatterContext context, MarkdownWriter markdown) protected StringtransformReferenceId(String nodeText, NodeFormatterContext context) protected voiduniquifyIds(NodeFormatterContext context, MarkdownWriter markdown, 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NodeFormatter
getBlockQuoteLikePrefixChar, getNodeClasses, getNodeFormattingHandlers
-
Field Details
-
FORMATTING_PHASES
-
referenceRepository
-
referenceList
-
unusedReferences
-
lastReference
-
recheckUndefinedReferences
protected boolean recheckUndefinedReferences -
repositoryNodesDone
protected boolean repositoryNodesDone -
myComparator
-
referenceTranslationMap
-
referenceUniqificationMap
-
myReferenceMapKey
-
myReferenceUniqificationMapKey
-
-
Constructor Details
-
NodeRepositoryFormatter
-
-
Method Details
-
getReferenceComparator
-
getRepository
-
getReferencePlacement
-
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
-
modifyTransformedReference
public String modifyTransformedReference(String transformedReferenceId, NodeFormatterContext context) -
renderReferenceBlockUnique
private void renderReferenceBlockUnique(B node, NodeFormatterContext context, MarkdownWriter markdown) -
transformReferenceId
-
getFormattingPhases
- Specified by:
getFormattingPhasesin interfacePhasedNodeFormatter
-
renderDocument
public void renderDocument(@NotNull @NotNull NodeFormatterContext context, @NotNull @NotNull MarkdownWriter markdown, @NotNull @NotNull Document document, @NotNull @NotNull FormattingPhase phase) Description copied from interface:PhasedNodeFormatterRender the specified node.- Specified by:
renderDocumentin 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 ofFormattingPhaseexceptFormattingPhase.DOCUMENTbecause this phase is used for the non-phased node rendering
-
formatReferences
-
renderReference
-
uniquifyIds
protected void uniquifyIds(NodeFormatterContext context, MarkdownWriter markdown, 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-
-