Interface HtmlNodeConverterContext
-
- All Superinterfaces:
NodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- All Known Implementing Classes:
HtmlNodeConverterSubContext
public interface HtmlNodeConverterContext extends NodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
The context for node rendering, including configuration and functionality for the node renderer to use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
appendOuterHtml(org.jsoup.nodes.Node node)
void
delegateRender()
java.lang.String
escapeSpecialChars(java.lang.String text)
void
excludeAttributes(java.lang.String... excludes)
org.jsoup.nodes.Node
getCurrentNode()
org.jsoup.nodes.Document
getDocument()
java.util.HashSet<Reference>
getExternalReferences()
Document
getForDocument()
HtmlConverterPhase
getFormattingPhase()
HtmlConverterOptions
getHtmlConverterOptions()
HtmlMarkdownWriter
getMarkdown()
DataHolder
getOptions()
Get the current rendering contextDataHolder
.Reference
getOrCreateReference(java.lang.String url, java.lang.String text, java.lang.String title)
java.util.HashMap<java.lang.String,Reference>
getReferenceIdToReferenceMap()
java.util.HashMap<java.lang.String,Reference>
getReferenceUrlToReferenceMap()
HtmlConverterState
getState()
java.util.Stack<HtmlConverterState>
getStateStack()
HtmlNodeConverterContext
getSubContext()
Creates a child rendering context that can be used to collect rendered html text.HtmlNodeConverterContext
getSubContext(DataHolder options)
Creates a child rendering context that can be used to collect rendered html text.HtmlNodeConverterContext
getSubContext(DataHolder options, ISequenceBuilder<?,?> builder)
Creates a child rendering context that can be used to collect rendered html text.void
inlineCode(java.lang.Runnable inlineRunnable)
boolean
isInlineCode()
boolean
isTrace()
org.jsoup.nodes.Node
next()
org.jsoup.nodes.Node
next(int skip)
int
outputAttributes(LineAppendable out, java.lang.String initialSep)
Node
parseMarkdown(java.lang.String markdown)
org.jsoup.nodes.Node
peek()
org.jsoup.nodes.Node
peek(int skip)
void
popState(LineAppendable out)
java.lang.String
prepareText(java.lang.String text)
java.lang.String
prepareText(java.lang.String text, boolean inCode)
void
processAttributes(org.jsoup.nodes.Node node)
void
processConditional(ExtensionConversion extensionConversion, org.jsoup.nodes.Node node, java.lang.Runnable processNode)
java.lang.String
processTextNodes(org.jsoup.nodes.Node node)
void
processTextNodes(org.jsoup.nodes.Node node, boolean stripIdAttribute)
void
processTextNodes(org.jsoup.nodes.Node node, boolean stripIdAttribute, java.lang.CharSequence wrapText)
void
processTextNodes(org.jsoup.nodes.Node node, boolean stripIdAttribute, java.lang.CharSequence textPrefix, java.lang.CharSequence textSuffix)
void
processUnwrapped(org.jsoup.nodes.Node element)
void
processWrapped(org.jsoup.nodes.Node node, java.lang.Boolean isBlock, boolean escapeMarkdown)
void
pushState(org.jsoup.nodes.Node parent)
void
render(org.jsoup.nodes.Node node)
Render the specified node and its children using the configured renderers.void
renderChildren(org.jsoup.nodes.Node parent, boolean outputAttributes, java.lang.Runnable prePopAction)
Render the children of the node, used by custom renderersvoid
renderDefault(org.jsoup.nodes.Node node)
ResolvedLink
resolveLink(LinkType linkType, java.lang.CharSequence url, Attributes attributes, java.lang.Boolean urlEncode)
ResolvedLink
resolveLink(LinkType linkType, java.lang.CharSequence url, java.lang.Boolean urlEncode)
void
setInlineCode(boolean inlineCode)
void
setTrace(boolean trace)
void
skip()
void
skip(int skip)
void
transferIdToParent()
void
transferToParentExcept(java.lang.String... excludes)
void
transferToParentOnly(java.lang.String... includes)
void
wrapTextNodes(org.jsoup.nodes.Node node, java.lang.CharSequence wrapText, boolean needSpaceAround)
-
-
-
Method Detail
-
getMarkdown
HtmlMarkdownWriter getMarkdown()
- Returns:
- the
LineAppendable
writer to use
-
delegateRender
void delegateRender()
-
getSubContext
@NotNull HtmlNodeConverterContext getSubContext()
Creates 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.- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- Returns:
- a new rendering context with a given appendable for its output
-
getSubContext
@NotNull HtmlNodeConverterContext getSubContext(@Nullable DataHolder options)
Creates 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.- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- 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 HtmlNodeConverterContext getSubContext(@Nullable DataHolder options, @NotNull ISequenceBuilder<?,?> builder)
Creates 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.- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- 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
-
render
void render(@NotNull org.jsoup.nodes.Node node)
Render 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
-
renderChildren
void renderChildren(@NotNull org.jsoup.nodes.Node parent, boolean outputAttributes, @Nullable java.lang.Runnable prePopAction)
Render 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
-
getFormattingPhase
HtmlConverterPhase getFormattingPhase()
- Returns:
- current rendering phase
-
getOptions
@NotNull DataHolder getOptions()
Get 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 usegetDocument()
as the data holder.- Specified by:
getOptions
in interfaceNodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- Returns:
- the current renderer options
DataHolder
-
getHtmlConverterOptions
@NotNull HtmlConverterOptions getHtmlConverterOptions()
- Returns:
- the
HtmlConverterOptions
for the context.
-
getDocument
@NotNull org.jsoup.nodes.Document getDocument()
- Returns:
- the
Document
node of the current context
-
getForDocument
@Nullable Document getForDocument()
- Returns:
- the
Document
node of the current context
-
getState
@Nullable HtmlConverterState getState()
-
getReferenceUrlToReferenceMap
@NotNull java.util.HashMap<java.lang.String,Reference> getReferenceUrlToReferenceMap()
-
getReferenceIdToReferenceMap
@NotNull java.util.HashMap<java.lang.String,Reference> getReferenceIdToReferenceMap()
-
getExternalReferences
@NotNull java.util.HashSet<Reference> getExternalReferences()
-
isTrace
boolean isTrace()
-
getStateStack
@NotNull java.util.Stack<HtmlConverterState> getStateStack()
-
setTrace
void setTrace(boolean trace)
-
parseMarkdown
@NotNull Node parseMarkdown(@NotNull java.lang.String markdown)
-
getOrCreateReference
@Nullable Reference getOrCreateReference(@NotNull java.lang.String url, @NotNull java.lang.String text, @Nullable java.lang.String title)
-
resolveLink
@NotNull ResolvedLink resolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, @Nullable java.lang.Boolean urlEncode)
-
resolveLink
@NotNull ResolvedLink resolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, @Nullable Attributes attributes, @Nullable java.lang.Boolean urlEncode)
-
getCurrentNode
@Nullable org.jsoup.nodes.Node getCurrentNode()
- Specified by:
getCurrentNode
in interfaceNodeContext<org.jsoup.nodes.Node,HtmlNodeConverterContext>
- Returns:
- the current node being rendered
-
pushState
void pushState(@NotNull org.jsoup.nodes.Node parent)
-
popState
void popState(@Nullable LineAppendable out)
-
excludeAttributes
void excludeAttributes(java.lang.String... excludes)
-
processAttributes
void processAttributes(@NotNull org.jsoup.nodes.Node node)
-
outputAttributes
int outputAttributes(@NotNull LineAppendable out, @NotNull java.lang.String initialSep)
-
transferIdToParent
void transferIdToParent()
-
transferToParentExcept
void transferToParentExcept(java.lang.String... excludes)
-
transferToParentOnly
void transferToParentOnly(java.lang.String... includes)
-
peek
@Nullable org.jsoup.nodes.Node peek()
-
peek
@Nullable org.jsoup.nodes.Node peek(int skip)
-
next
@Nullable org.jsoup.nodes.Node next()
-
skip
void skip()
-
next
@Nullable org.jsoup.nodes.Node next(int skip)
-
skip
void skip(int skip)
-
processUnwrapped
void processUnwrapped(@NotNull org.jsoup.nodes.Node element)
-
processWrapped
void processWrapped(@NotNull org.jsoup.nodes.Node node, @Nullable java.lang.Boolean isBlock, boolean escapeMarkdown)
-
processTextNodes
void processTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute)
-
processTextNodes
void processTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull java.lang.CharSequence wrapText)
-
processTextNodes
void processTextNodes(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable java.lang.CharSequence textPrefix, @Nullable java.lang.CharSequence textSuffix)
-
wrapTextNodes
void wrapTextNodes(@NotNull org.jsoup.nodes.Node node, @NotNull java.lang.CharSequence wrapText, boolean needSpaceAround)
-
processTextNodes
@NotNull java.lang.String processTextNodes(@NotNull org.jsoup.nodes.Node node)
-
appendOuterHtml
void appendOuterHtml(@NotNull org.jsoup.nodes.Node node)
-
isInlineCode
boolean isInlineCode()
-
setInlineCode
void setInlineCode(boolean inlineCode)
-
escapeSpecialChars
@NotNull java.lang.String escapeSpecialChars(@NotNull java.lang.String text)
-
prepareText
@NotNull java.lang.String prepareText(@NotNull java.lang.String text)
-
prepareText
@NotNull java.lang.String prepareText(@NotNull java.lang.String text, boolean inCode)
-
inlineCode
void inlineCode(@NotNull java.lang.Runnable inlineRunnable)
-
processConditional
void processConditional(@NotNull ExtensionConversion extensionConversion, @NotNull org.jsoup.nodes.Node node, @NotNull java.lang.Runnable processNode)
-
renderDefault
void renderDefault(@NotNull org.jsoup.nodes.Node node)
-
-