Package com.vladsch.flexmark.formatter
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 B
protected final Comparator
<B> protected boolean
protected final R
protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionNodeRepositoryFormatter
(DataHolder options, DataKey<Map<String, String>> referenceMapKey, DataKey<Map<String, String>> uniquificationMapKey) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
formatReferences
(NodeFormatterContext context, MarkdownWriter markdown) @Nullable Set
<FormattingPhase> abstract ElementPlacement
abstract ElementPlacementSort
abstract R
getRepository
(DataHolder options) protected ElementPlacement
protected boolean
Whether references should be made uniquemodifyTransformedReference
(String transformedReferenceId, NodeFormatterContext context) void
renderDocument
(@NotNull NodeFormatterContext context, @NotNull MarkdownWriter markdown, @NotNull 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) private void
renderReferenceBlockUnique
(B node, NodeFormatterContext context, MarkdownWriter markdown) protected String
transformReferenceId
(String nodeText, NodeFormatterContext context) 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.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 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:
getFormattingPhases
in 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: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
-
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
-
-