Class AttributesNodeFormatter
- java.lang.Object
-
- com.vladsch.flexmark.ext.attributes.internal.AttributesNodeFormatter
-
- All Implemented Interfaces:
ExplicitAttributeIdProvider
,NodeFormatter
,PhasedNodeFormatter
public class AttributesNodeFormatter extends java.lang.Object implements PhasedNodeFormatter, ExplicitAttributeIdProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributesNodeFormatter.Factory
-
Field Summary
Fields Modifier and Type Field Description static DataKey<java.util.Map<java.lang.String,java.lang.String>>
ATTRIBUTE_ORIGINAL_ID_MAP
static DataKey<java.util.Map<java.lang.String,java.lang.String>>
ATTRIBUTE_TRANSLATED_MAP
static DataKey<java.lang.Integer>
ATTRIBUTE_TRANSLATION_ID
static DataKey<java.util.Map<java.lang.String,java.lang.String>>
ATTRIBUTE_TRANSLATION_MAP
static DataKey<java.util.Map<java.lang.String,java.lang.String>>
ATTRIBUTE_UNIQUIFICATION_CATEGORY_MAP
static DataKey<java.util.Map<java.lang.String,java.lang.String>>
ATTRIBUTE_UNIQUIFICATION_ID_MAP
private int
attributeOriginalId
private java.util.Map<java.lang.String,java.lang.String>
attributeOriginalIdMap
private java.util.Map<java.lang.String,java.lang.String>
attributeTranslatedMap
private java.util.Map<java.lang.String,java.lang.String>
attributeTranslationMap
private java.util.Map<java.lang.String,java.lang.String>
attributeUniquificationIdMap
private AttributesFormatOptions
formatOptions
static DataKey<java.util.Set<Node>>
PROCESSED_ATTRIBUTES
-
Constructor Summary
Constructors Constructor Description AttributesNodeFormatter(DataHolder options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExplicitId(@NotNull Node node, @Nullable java.lang.String id, @NotNull NodeFormatterContext context, @NotNull MarkdownWriter markdown)
Used by AttributesExtension to insert attributes for headings during merge(package private) static AttributeNode
combineAttributes(java.util.LinkedHashMap<java.lang.String,AttributeNode> attributeNodes, AttributeNode attributeNode)
static java.lang.String
getEncodedIdAttribute(java.lang.String category, java.lang.String categoryId, NodeFormatterContext context, MarkdownWriter markdown)
private static java.lang.String
getEncodedIdAttribute(java.lang.String category, java.lang.String categoryId, NodeFormatterContext context, MarkdownWriter markdown, java.util.Map<java.lang.String,java.lang.String> attributeTranslationMap, java.util.Map<java.lang.String,java.lang.String> attributeTranslatedMap)
private java.lang.String
getEncodedOriginalId(java.lang.String attribute, NodeFormatterContext context)
@Nullable java.util.Set<FormattingPhase>
getFormattingPhases()
@Nullable java.util.Set<java.lang.Class<?>>
getNodeClasses()
Collect nodes of given type so that they can be quickly accessed without traversing the AST by all formatting extensions.@Nullable java.util.Set<NodeFormattingHandler<?>>
getNodeFormattingHandlers()
(package private) boolean
hasNoIdAttribute(Node node)
(package private) void
render(AttributesNode node, NodeFormatterContext context, MarkdownWriter markdown)
void
renderDocument(@NotNull NodeFormatterContext context, @NotNull MarkdownWriter markdown, @NotNull Document document, @NotNull FormattingPhase phase)
Render the specified node.-
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
-
-
-
-
Field Detail
-
ATTRIBUTE_TRANSLATION_MAP
public static final DataKey<java.util.Map<java.lang.String,java.lang.String>> ATTRIBUTE_TRANSLATION_MAP
-
ATTRIBUTE_TRANSLATED_MAP
public static final DataKey<java.util.Map<java.lang.String,java.lang.String>> ATTRIBUTE_TRANSLATED_MAP
-
ATTRIBUTE_ORIGINAL_ID_MAP
public static final DataKey<java.util.Map<java.lang.String,java.lang.String>> ATTRIBUTE_ORIGINAL_ID_MAP
-
ATTRIBUTE_UNIQUIFICATION_ID_MAP
public static final DataKey<java.util.Map<java.lang.String,java.lang.String>> ATTRIBUTE_UNIQUIFICATION_ID_MAP
-
ATTRIBUTE_UNIQUIFICATION_CATEGORY_MAP
public static final DataKey<java.util.Map<java.lang.String,java.lang.String>> ATTRIBUTE_UNIQUIFICATION_CATEGORY_MAP
-
ATTRIBUTE_TRANSLATION_ID
public static final DataKey<java.lang.Integer> ATTRIBUTE_TRANSLATION_ID
-
attributeTranslationMap
private java.util.Map<java.lang.String,java.lang.String> attributeTranslationMap
-
attributeTranslatedMap
private java.util.Map<java.lang.String,java.lang.String> attributeTranslatedMap
-
attributeOriginalIdMap
private java.util.Map<java.lang.String,java.lang.String> attributeOriginalIdMap
-
attributeUniquificationIdMap
private java.util.Map<java.lang.String,java.lang.String> attributeUniquificationIdMap
-
attributeOriginalId
private int attributeOriginalId
-
formatOptions
private final AttributesFormatOptions formatOptions
-
-
Constructor Detail
-
AttributesNodeFormatter
public AttributesNodeFormatter(DataHolder options)
-
-
Method Detail
-
getNodeClasses
@Nullable public @Nullable java.util.Set<java.lang.Class<?>> getNodeClasses()
Description copied from interface:NodeFormatter
Collect nodes of given type so that they can be quickly accessed without traversing the AST by all formatting extensions.- Specified by:
getNodeClasses
in interfaceNodeFormatter
- Returns:
- the nodes of interest to this formatter during formatting.
-
getFormattingPhases
@Nullable public @Nullable java.util.Set<FormattingPhase> getFormattingPhases()
- Specified by:
getFormattingPhases
in interfacePhasedNodeFormatter
-
addExplicitId
public void addExplicitId(@NotNull @NotNull Node node, @Nullable @Nullable java.lang.String id, @NotNull @NotNull NodeFormatterContext context, @NotNull @NotNull MarkdownWriter markdown)
Description copied from interface:ExplicitAttributeIdProvider
Used by AttributesExtension to insert attributes for headings during merge- Specified by:
addExplicitId
in interfaceExplicitAttributeIdProvider
- Parameters:
node
- nodeid
- explicit idcontext
- contextmarkdown
- markdown writer
-
hasNoIdAttribute
boolean hasNoIdAttribute(Node node)
-
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
-
getNodeFormattingHandlers
@Nullable public @Nullable java.util.Set<NodeFormattingHandler<?>> getNodeFormattingHandlers()
- Specified by:
getNodeFormattingHandlers
in interfaceNodeFormatter
- Returns:
- the mapping of nodes this renderer handles to rendering function
-
getEncodedIdAttribute
public static java.lang.String getEncodedIdAttribute(java.lang.String category, java.lang.String categoryId, NodeFormatterContext context, MarkdownWriter markdown)
-
getEncodedIdAttribute
private static java.lang.String getEncodedIdAttribute(java.lang.String category, java.lang.String categoryId, NodeFormatterContext context, MarkdownWriter markdown, java.util.Map<java.lang.String,java.lang.String> attributeTranslationMap, java.util.Map<java.lang.String,java.lang.String> attributeTranslatedMap)
-
getEncodedOriginalId
private java.lang.String getEncodedOriginalId(java.lang.String attribute, NodeFormatterContext context)
-
render
void render(AttributesNode node, NodeFormatterContext context, MarkdownWriter markdown)
-
combineAttributes
static AttributeNode combineAttributes(java.util.LinkedHashMap<java.lang.String,AttributeNode> attributeNodes, AttributeNode attributeNode)
-
-