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>>

  • 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 Detail

      • 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
      • referenceUniqificationMap

        protected Map<String,​String> referenceUniqificationMap
    • Constructor Detail

      • NodeRepositoryFormatter

        public NodeRepositoryFormatter​(com.vladsch.flexmark.util.data.DataHolder options,
                                       com.vladsch.flexmark.util.data.DataKey<Map<String,​String>> referenceMapKey,
                                       com.vladsch.flexmark.util.data.DataKey<Map<String,​String>> uniquificationMapKey)
    • 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()
      • 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)
      • 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 interface PhasedNodeFormatter
        Parameters:
        context - node renderer context instance
        markdown - markdown writer instance
        document - the document node to render
        phase - rendering phase for which to generate the output. Will be any of FormattingPhase except FormattingPhase.DOCUMENT because this phase is used for the non-phased node rendering
      • 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 -