Interface LinkResolverContext
- All Superinterfaces:
LinkResolverBasicContext
- All Known Subinterfaces:
NodeFormatterContext
,NodeRendererContext
- All Known Implementing Classes:
Formatter.MainNodeFormatter
,Formatter.MainNodeFormatter.SubNodeFormatter
,HtmlRenderer.MainNodeRenderer
,HtmlRenderer.MainNodeRenderer.SubNodeRenderer
,NodeFormatterSubContext
,NodeRendererSubContext
-
Method Summary
Modifier and TypeMethodDescription@NotNull String
encodeUrl
(@NotNull CharSequence url) @NotNull Node
@NotNull Document
@NotNull DataHolder
Get the current rendering contextDataHolder
.void
Render the specified node and its children using the configured renderers.void
renderChildren
(@NotNull Node parent) Render the children of the node, used by custom renderers@NotNull ResolvedLink
resolveLink
(@NotNull LinkType linkType, @NotNull CharSequence url, @Nullable Attributes attributes, @Nullable Boolean urlEncode) Resolve link for rendering.default @NotNull ResolvedLink
resolveLink
(@NotNull LinkType linkType, @NotNull CharSequence url, @Nullable Boolean urlEncode) Resolve link for rendering.
-
Method Details
-
getOptions
Get the current rendering contextDataHolder
. These are the options passed or set on theHtmlRenderer.builder()
or passed toHtmlRenderer.builder(DataHolder)
. To get the document options you should usegetDocument()
as the data holder.- Specified by:
getOptions
in interfaceLinkResolverBasicContext
- Returns:
- the current renderer options
DataHolder
-
getDocument
- Specified by:
getDocument
in interfaceLinkResolverBasicContext
- Returns:
- the
Document
node of the current context
-
encodeUrl
- Parameters:
url
- to be encoded- Returns:
- an encoded URL (depending on the configuration)
-
render
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
Render the children of the node, used by custom renderers- Parameters:
parent
- node the children of which are to be rendered
-
getCurrentNode
- Returns:
- the current node being rendered
-
resolveLink
@NotNull default @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, @Nullable @Nullable Boolean urlEncode) Resolve link for rendering. Link Resolvers are going to be called until one returns ResolvedLink with getStatus() != LinkStatus.UnknownA resolver can replace the url but not change the status letting downstream resolvers handle the rest. This is useful when a resolver does partial processing like macro expansion but does not know how to handle the rest.
Core processing will simply pass the link as is. It is up to extension LinkResolvers and AttributeProviders to make sense of the link and applicable attributes based on status.
- Parameters:
linkType
- type of link being rendered. Core defined links are Link, Image. Extensions can define their ownurl
- link url texturlEncode
- whether the link should be url encoded, if null then the value ofHtmlRenderer.PERCENT_ENCODE_URLS
will be used to determine whether the resolved URL is to be encoded.- Returns:
- resolved link url for this link and its resolved status
-
resolveLink
@NotNull @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, @Nullable @Nullable Attributes attributes, @Nullable @Nullable Boolean urlEncode) Resolve link for rendering. Link Resolvers are going to be called until one returns ResolvedLink with getStatus() != LinkStatus.UnknownA resolver can replace the url but not change the status letting downstream resolvers handle the rest. This is useful when a resolver does partial processing like macro expansion but does not know how to handle the rest.
Core processing will simply pass the link as is. It is up to extension LinkResolvers and AttributeProviders to make sense of the link and applicable attributes based on status.
- Parameters:
linkType
- type of link being rendered. Core defined links are Link, Image. Extensions can define their ownurl
- link url textattributes
- link attributesurlEncode
- whether the link should be url encoded, if null then the value ofHtmlRenderer.PERCENT_ENCODE_URLS
will be used to determine whether the resolved URL is to be encoded.- Returns:
- resolved link url for this link and its resolved status
-