Class FlexmarkHtmlConverter.MainHtmlConverter
- java.lang.Object
-
- com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
-
- com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter.MainHtmlConverter
-
- All Implemented Interfaces:
HtmlNodeConverterContext,NodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- Enclosing class:
- FlexmarkHtmlConverter
private class FlexmarkHtmlConverter.MainHtmlConverter extends HtmlNodeConverterSubContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classFlexmarkHtmlConverter.MainHtmlConverter.SubHtmlNodeConverter
-
Field Summary
Fields Modifier and Type Field Description private @NotNull org.jsoup.nodes.Documentdocumentprivate @NotNull java.util.HashSet<Reference>myExternalReferencesprivate DocumentmyForDocumentprivate @NotNull HtmlConverterOptionsmyHtmlConverterOptionsprivate @NotNull HtmlLinkResolver[]myHtmlLinkResolversprivate booleanmyInlineCodeprivate @NotNull DataHoldermyOptionsprivate @Nullable ParsermyParserprivate @NotNull java.util.HashMap<java.lang.String,Reference>myReferenceUrlToReferenceMapprivate @NotNull java.util.Map<java.lang.String,java.lang.String>mySpecialCharsMapprivate @Nullable HtmlConverterStatemyStateprivate @NotNull java.util.Stack<HtmlConverterState>myStateStackprivate booleanmyTraceprivate HtmlConverterPhasephaseprivate @NotNull java.util.List<PhasedHtmlNodeRenderer>phasedFormattersprivate @NotNull java.util.Map<java.lang.String,HtmlNodeRendererHandler<?>>renderersprivate @NotNull java.util.Set<HtmlConverterPhase>renderingPhasesprivate @Nullable java.util.regex.PatternspecialCharsPattern-
Fields inherited from class com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
markdown, myRenderingNode, renderingHandlerWrapper
-
-
Constructor Summary
Constructors Constructor Description MainHtmlConverter(@NotNull DataHolder options, @NotNull HtmlMarkdownWriter out, @NotNull org.jsoup.nodes.Document document, @Nullable DataHolder parentOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendOuterHtml(@NotNull org.jsoup.nodes.Node node)voiddelegateRender()private java.lang.StringdumpState()@NotNull java.lang.StringescapeSpecialChars(@NotNull java.lang.String text)voidexcludeAttributes(java.lang.String... excludes)@Nullable org.jsoup.nodes.NodegetCurrentNode()@NotNull org.jsoup.nodes.DocumentgetDocument()@NotNull java.util.HashSet<Reference>getExternalReferences()DocumentgetForDocument()HtmlConverterPhasegetFormattingPhase()@NotNull HtmlConverterOptionsgetHtmlConverterOptions()@NotNull DataHoldergetOptions()Get the current rendering contextDataHolder.ReferencegetOrCreateReference(@NotNull java.lang.String url, @NotNull java.lang.String text, @Nullable java.lang.String title)@NotNull java.util.HashMap<java.lang.String,Reference>getReferenceUrlToReferenceMap()HtmlConverterStategetState()@NotNull java.util.Stack<HtmlConverterState>getStateStack()@NotNull HtmlNodeConverterContextgetSubContext()Creates a child rendering context that can be used to collect rendered html text.@NotNull HtmlNodeConverterContextgetSubContext(@Nullable DataHolder options)Creates a child rendering context that can be used to collect rendered html text.@NotNull HtmlNodeConverterContextgetSubContext(@Nullable DataHolder options, @NotNull ISequenceBuilder<?,?> builder)Creates a child rendering context that can be used to collect rendered html text.voidinlineCode(@NotNull java.lang.Runnable inlineRunnable)booleanisInlineCode()booleanisTrace()@Nullable org.jsoup.nodes.Nodenext()@Nullable org.jsoup.nodes.Nodenext(int skip)intoutputAttributes(@NotNull LineAppendable out, @NotNull java.lang.String initialSep)@NotNull NodeparseMarkdown(@NotNull java.lang.String markdown)@Nullable org.jsoup.nodes.Nodepeek()@Nullable org.jsoup.nodes.Nodepeek(int skip)voidpopState(@Nullable LineAppendable out)@NotNull java.lang.StringprepareText(@NotNull java.lang.String text)@NotNull java.lang.StringprepareText(@NotNull java.lang.String text, boolean inCode)voidprocessAttributes(@NotNull org.jsoup.nodes.Node node)voidprocessConditional(@NotNull ExtensionConversion extensionConversion, @NotNull org.jsoup.nodes.Node node, @NotNull java.lang.Runnable processNode)@NotNull java.lang.StringprocessTextNodes(@NotNull org.jsoup.nodes.Node node)voidprocessTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute)voidprocessTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull java.lang.CharSequence wrapText)voidprocessTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable java.lang.CharSequence textPrefix, @Nullable java.lang.CharSequence textSuffix)voidprocessUnwrapped(@NotNull org.jsoup.nodes.Node element)(package private) voidprocessUnwrapped(HtmlNodeConverterSubContext context, org.jsoup.nodes.Node element)voidprocessWrapped(@NotNull org.jsoup.nodes.Node node, @Nullable java.lang.Boolean isBlock, boolean escapeMarkdown)voidpushState(@NotNull org.jsoup.nodes.Node parent)voidrender(@NotNull org.jsoup.nodes.Node node)Render the specified node and its children using the configured renderers.(package private) voidrenderByPreviousHandler(HtmlNodeConverterSubContext subContext)voidrenderChildren(@NotNull org.jsoup.nodes.Node parent, boolean outputAttributes, java.lang.Runnable prePopAction)Render the children of the node, used by custom renderersvoidrenderDefault(@NotNull org.jsoup.nodes.Node node)(package private) voidrenderNode(org.jsoup.nodes.Node node, HtmlNodeConverterSubContext subContext)@NotNull ResolvedLinkresolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, Attributes attributes, java.lang.Boolean urlEncode)@NotNull ResolvedLinkresolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, java.lang.Boolean urlEncode)voidsetInlineCode(boolean inlineCode)voidsetTrace(boolean trace)voidskip()voidskip(int skip)voidtransferIdToParent()voidtransferToParentExcept(java.lang.String... excludes)voidtransferToParentOnly(java.lang.String... includes)voidwrapTextNodes(@NotNull org.jsoup.nodes.Node node, @NotNull java.lang.CharSequence wrapText, boolean needSpaceAround)-
Methods inherited from class com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
flushTo, flushTo, getMarkdown, getRenderingNode, setRenderingNode
-
-
-
-
Field Detail
-
document
@NotNull private final @NotNull org.jsoup.nodes.Document document
-
myForDocument
@NotNull private final Document myForDocument
-
renderers
@NotNull private final @NotNull java.util.Map<java.lang.String,HtmlNodeRendererHandler<?>> renderers
-
phasedFormatters
@NotNull private final @NotNull java.util.List<PhasedHtmlNodeRenderer> phasedFormatters
-
renderingPhases
@NotNull private final @NotNull java.util.Set<HtmlConverterPhase> renderingPhases
-
myOptions
@NotNull private final @NotNull DataHolder myOptions
-
phase
private HtmlConverterPhase phase
-
myHtmlConverterOptions
@NotNull private final @NotNull HtmlConverterOptions myHtmlConverterOptions
-
specialCharsPattern
@Nullable private final @Nullable java.util.regex.Pattern specialCharsPattern
-
myStateStack
@NotNull private final @NotNull java.util.Stack<HtmlConverterState> myStateStack
-
mySpecialCharsMap
@NotNull private final @NotNull java.util.Map<java.lang.String,java.lang.String> mySpecialCharsMap
-
myState
@Nullable private @Nullable HtmlConverterState myState
-
myTrace
private boolean myTrace
-
myInlineCode
private boolean myInlineCode
-
myParser
@Nullable private @Nullable Parser myParser
-
myHtmlLinkResolvers
@NotNull private final @NotNull HtmlLinkResolver[] myHtmlLinkResolvers
-
myReferenceUrlToReferenceMap
@NotNull private final @NotNull java.util.HashMap<java.lang.String,Reference> myReferenceUrlToReferenceMap
-
myExternalReferences
@NotNull private final @NotNull java.util.HashSet<Reference> myExternalReferences
-
-
Constructor Detail
-
MainHtmlConverter
MainHtmlConverter(@NotNull @NotNull DataHolder options, @NotNull @NotNull HtmlMarkdownWriter out, @NotNull @NotNull org.jsoup.nodes.Document document, @Nullable @Nullable DataHolder parentOptions)
-
-
Method Detail
-
getState
public HtmlConverterState getState()
-
getReferenceUrlToReferenceMap
@NotNull public @NotNull java.util.HashMap<java.lang.String,Reference> getReferenceUrlToReferenceMap()
-
getExternalReferences
@NotNull public @NotNull java.util.HashSet<Reference> getExternalReferences()
-
isTrace
public boolean isTrace()
-
getStateStack
@NotNull public @NotNull java.util.Stack<HtmlConverterState> getStateStack()
-
setTrace
public void setTrace(boolean trace)
-
parseMarkdown
public @NotNull Node parseMarkdown(@NotNull @NotNull java.lang.String markdown)
-
getOrCreateReference
public Reference getOrCreateReference(@NotNull @NotNull java.lang.String url, @NotNull @NotNull java.lang.String text, @Nullable @Nullable java.lang.String title)
-
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull java.lang.CharSequence url, java.lang.Boolean urlEncode)
-
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull java.lang.CharSequence url, Attributes attributes, java.lang.Boolean urlEncode)
-
getCurrentNode
@Nullable public @Nullable org.jsoup.nodes.Node getCurrentNode()
- Returns:
- the current node being rendered
-
getOptions
@NotNull public @NotNull DataHolder getOptions()
Description copied from interface:HtmlNodeConverterContextGet the current rendering contextDataHolder. These are the options passed or set on theFlexmarkHtmlConverter.builder()or passed toFlexmarkHtmlConverter.builder(DataHolder). To get the document options you should useHtmlNodeConverterContext.getDocument()as the data holder.- Returns:
- the current renderer options
DataHolder
-
getHtmlConverterOptions
@NotNull public @NotNull HtmlConverterOptions getHtmlConverterOptions()
- Returns:
- the
HtmlConverterOptionsfor the context.
-
getDocument
@NotNull public @NotNull org.jsoup.nodes.Document getDocument()
- Returns:
- the
Documentnode of the current context
-
getForDocument
@Nullable public Document getForDocument()
- Returns:
- the
Documentnode of the current context
-
getFormattingPhase
public HtmlConverterPhase getFormattingPhase()
- Returns:
- current rendering phase
-
render
public void render(@NotNull @NotNull org.jsoup.nodes.Node node)Description copied from interface:HtmlNodeConverterContextRender the specified node and its children using the configured renderers. This should be used to render child nodes; be careful not to pass the node that is being rendered, that would result in an endless loop.- Parameters:
node- the node to render
-
delegateRender
public void delegateRender()
-
renderByPreviousHandler
void renderByPreviousHandler(HtmlNodeConverterSubContext subContext)
-
getSubContext
@NotNull public @NotNull HtmlNodeConverterContext getSubContext()
Description copied from interface:HtmlNodeConverterContextCreates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Returns:
- a new rendering context with a given appendable for its output
-
getSubContext
@NotNull public @NotNull HtmlNodeConverterContext getSubContext(@Nullable @Nullable DataHolder options)
Description copied from interface:HtmlNodeConverterContextCreates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Parameters:
options- options to use for the context (only options which do not affect the context construction will be used)- Returns:
- a new rendering context with a given appendable for its output
-
getSubContext
@NotNull public @NotNull HtmlNodeConverterContext getSubContext(@Nullable @Nullable DataHolder options, @NotNull @NotNull ISequenceBuilder<?,?> builder)
Description copied from interface:HtmlNodeConverterContextCreates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Parameters:
options- options to use for the context (only options which do not affect the context construction will be used)builder- sequence builder to user for appended text for tracking original base offsets- Returns:
- a new rendering context with a given appendable for its output
-
renderNode
void renderNode(org.jsoup.nodes.Node node, HtmlNodeConverterSubContext subContext)
-
renderChildren
public void renderChildren(@NotNull @NotNull org.jsoup.nodes.Node parent, boolean outputAttributes, java.lang.Runnable prePopAction)Description copied from interface:HtmlNodeConverterContextRender the children of the node, used by custom renderers- Parameters:
parent- node the children of which are to be renderedoutputAttributes- true if attributes should be outputprePopAction- runnable to run before popping state
-
pushState
public void pushState(@NotNull @NotNull org.jsoup.nodes.Node parent)
-
excludeAttributes
public void excludeAttributes(java.lang.String... excludes)
-
processAttributes
public void processAttributes(@NotNull @NotNull org.jsoup.nodes.Node node)
-
outputAttributes
public int outputAttributes(@NotNull @NotNull LineAppendable out, @NotNull @NotNull java.lang.String initialSep)
-
transferIdToParent
public void transferIdToParent()
-
transferToParentExcept
public void transferToParentExcept(java.lang.String... excludes)
-
transferToParentOnly
public void transferToParentOnly(java.lang.String... includes)
-
popState
public void popState(@Nullable @Nullable LineAppendable out)
-
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek()
-
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek(int skip)
-
next
@Nullable public @Nullable org.jsoup.nodes.Node next()
-
skip
public void skip()
-
next
@Nullable public @Nullable org.jsoup.nodes.Node next(int skip)
-
skip
public void skip(int skip)
-
dumpState
private java.lang.String dumpState()
-
processUnwrapped
public void processUnwrapped(@NotNull @NotNull org.jsoup.nodes.Node element)
-
processUnwrapped
void processUnwrapped(HtmlNodeConverterSubContext context, org.jsoup.nodes.Node element)
-
processWrapped
public void processWrapped(@NotNull @NotNull org.jsoup.nodes.Node node, @Nullable @Nullable java.lang.Boolean isBlock, boolean escapeMarkdown)
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute)
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull @NotNull java.lang.CharSequence wrapText)
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable @Nullable java.lang.CharSequence textPrefix, @Nullable @Nullable java.lang.CharSequence textSuffix)
-
wrapTextNodes
public void wrapTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull java.lang.CharSequence wrapText, boolean needSpaceAround)
-
processTextNodes
@NotNull public @NotNull java.lang.String processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node)
-
appendOuterHtml
public void appendOuterHtml(@NotNull @NotNull org.jsoup.nodes.Node node)
-
isInlineCode
public boolean isInlineCode()
-
setInlineCode
public void setInlineCode(boolean inlineCode)
-
inlineCode
public void inlineCode(@NotNull @NotNull java.lang.Runnable inlineRunnable)
-
prepareText
@NotNull public @NotNull java.lang.String prepareText(@NotNull @NotNull java.lang.String text)
-
prepareText
@NotNull public @NotNull java.lang.String prepareText(@NotNull @NotNull java.lang.String text, boolean inCode)
-
escapeSpecialChars
@NotNull public @NotNull java.lang.String escapeSpecialChars(@NotNull @NotNull java.lang.String text)
-
processConditional
public void processConditional(@NotNull @NotNull ExtensionConversion extensionConversion, @NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull java.lang.Runnable processNode)
-
renderDefault
public void renderDefault(@NotNull @NotNull org.jsoup.nodes.Node node)
-
-