Interface LinkResolverContext
-
- All Superinterfaces:
LinkResolverBasicContext
- All Known Subinterfaces:
DocxRendererContext
,NodeFormatterContext
,NodeRendererContext
- All Known Implementing Classes:
NodeFormatterSubContext
,NodeRendererSubContext
public interface LinkResolverContext extends LinkResolverBasicContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
encodeUrl(java.lang.CharSequence url)
Node
getCurrentNode()
Document
getDocument()
DataHolder
getOptions()
Get the current rendering contextDataHolder
.void
render(Node node)
Render the specified node and its children using the configured renderers.void
renderChildren(Node parent)
Render the children of the node, used by custom renderersResolvedLink
resolveLink(LinkType linkType, java.lang.CharSequence url, Attributes attributes, java.lang.Boolean urlEncode)
Resolve link for rendering.default ResolvedLink
resolveLink(LinkType linkType, java.lang.CharSequence url, java.lang.Boolean urlEncode)
Resolve link for rendering.
-
-
-
Method Detail
-
getOptions
@NotNull DataHolder 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
@NotNull Document getDocument()
- Specified by:
getDocument
in interfaceLinkResolverBasicContext
- Returns:
- the
Document
node of the current context
-
encodeUrl
@NotNull java.lang.String encodeUrl(@NotNull java.lang.CharSequence url)
- Parameters:
url
- to be encoded- Returns:
- an encoded URL (depending on the configuration)
-
render
void render(@NotNull 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 Node parent)
Render the children of the node, used by custom renderers- Parameters:
parent
- node the children of which are to be rendered
-
getCurrentNode
@NotNull Node getCurrentNode()
- Returns:
- the current node being rendered
-
resolveLink
@NotNull default ResolvedLink resolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, @Nullable java.lang.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 ResolvedLink resolveLink(@NotNull LinkType linkType, @NotNull java.lang.CharSequence url, @Nullable Attributes attributes, @Nullable java.lang.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
-
-