/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { String } from "../../types/java/lang/String"; import type { Node } from "../../types/javax/jcr/Node"; import type { LinkRenderer } from "../LinkRenderer"; import type { OutputUtilConstants } from "../../types/senselogic/sitevision/api/render/velocity/VelocityAccess.OutputUtilConstants"; /** * Output utility interface with methods that return complete content snippets. * *
* An instance of the Sitevision class implementing this interface can be obtained via {@link senselogic.sitevision.api.Utils#getOutputUtil()}.
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface.
*
aFontNode. The html element in the returned result
* will always be a paragraph (<p>) with no class attribute if aFontNode is null
* or not of primary type sv:font.
*
* Some examples:
*
* Method call: getHtmlText("Hello world! one < two", myFontNode)
* will return any of the following:
*
<h1 class="selectorTextOfMyFontNode">Hello world! one < two</h1><h2 class="selectorTextOfMyFontNode">Hello world! one < two</h2><h3 class="selectorTextOfMyFontNode">Hello world! one < two</h3><h4 class="selectorTextOfMyFontNode">Hello world! one < two</h4><h5 class="selectorTextOfMyFontNode">Hello world! one < two</h5><h6 class="selectorTextOfMyFontNode">Hello world! one < two</h6><p class="selectorTextOfMyFontNode">Hello world! one < two</p><span class="selectorTextOfMyFontNode">Hello world! one < two</span><code class="selectorTextOfMyFontNode">Hello world! one < two</code><sub class="selectorTextOfMyFontNode">Hello world! one < two</sub><sup class="selectorTextOfMyFontNode">Hello world! one < two</sup>
* Method call: getHtmlText("Hello world! one < two", null)
* will return this:
*
<p>Hello world! one < two</p>Node of primary type sv:font that determines the type of html element to use and the
class attribute value of the element
* @return aText embedded in a html element, or empty String if aText is null
* @see #getEscapedHtmlText(String, javax.jcr.Node)
* @since Sitevision 2.6.1_02
*/
getHtmlText(aText: String | string, aFontNode: Node): string;
/**
* Gets a text embedded in a html element with a class attribute and a style attribute.
*
* The html element used depends on the element type settings of the aFontNode. The html element in the returned result
* will always be a paragraph (<p>) with no class attribute if aFontNode is null
* or not of primary type sv:font.
*
* aStyle will be ignored if it is null.
*
* Some examples:
*
* Method call: getHtmlText("Hello world! one < two", myFontNode, "padding-left:0.7em")
* will return any of the following:
*
<h1 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h1><h2 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h2><h3 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h3><h4 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h4><h5 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h5><h6 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h6><p class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</p><span class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</span><code class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</code><sub class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</sub><sup class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</sup>Method call: getHtmlText("Hello world! one < two", null, "padding-left:0.7em")
* will return this:
*
<p style="padding-left:0.7em">Hello world! one < two</p>Method call: getHtmlText("Hello world! one < two", null, null)
* will return this:
*
<p>Hello world! one < two</p>Method call: getHtmlText("Hello world! one < two", myFontNode, null)
* will return the same result as if the {@link #getHtmlText(String, javax.jcr.Node) getHtmlText(String, Node)} method had been invoked.
*
Node of primary type sv:font that determines the type of html element to use and the
class attribute value of the element
* @param aStyle the style that should be inserted in the style attribute of the element
* @return aText embedded in a html element, or empty String if aText is null
* @see #getEscapedHtmlText(String, javax.jcr.Node, String)
* @since Sitevision 2.6.1_02
*/
getHtmlText(
aText: String | string,
aFontNode: Node,
aStyle: String | string
): string;
/**
* Gets a text escaped and embedded in a html element with a class attribute.
*
* The html element used depends on the element type settings of the aFontNode. The html element in the returned result
* will always be a paragraph (<p>) with no class attribute if aFontNode is null
* or not of primary type sv:font.
*
* Some examples:
*
* Method call: getEscapedHtmlText("Hello world! one < two", myFontNode)
* will return any of the following:
*
<h1 class="selectorTextOfMyFontNode">Hello world! one < two</h1><h2 class="selectorTextOfMyFontNode">Hello world! one < two</h2><h3 class="selectorTextOfMyFontNode">Hello world! one < two</h3><h4 class="selectorTextOfMyFontNode">Hello world! one < two</h4><h5 class="selectorTextOfMyFontNode">Hello world! one < two</h5><h6 class="selectorTextOfMyFontNode">Hello world! one < two</h6><p class="selectorTextOfMyFontNode">Hello world! one < two</p><span class="selectorTextOfMyFontNode">Hello world! one < two</span><code class="selectorTextOfMyFontNode">Hello world! one < two</code><sub class="selectorTextOfMyFontNode">Hello world! one < two</sub><sup class="selectorTextOfMyFontNode">Hello world! one < two</sup>
* Method call: getEscapedHtmlText("Hello world! one < two", null)
* will return this:
*
<p>Hello world! one < two</p>Node of primary type sv:font that determines the type of html element to use and the
class attribute value of the element
* @return aPlainText escaped and embedded in a html element, or empty String if aPlainText is null
* @see #getHtmlText(String, javax.jcr.Node)
* @since Sitevision 2.6.1_02
*/
getEscapedHtmlText(aPlainText: String | string, aFontNode: Node): string;
/**
* Gets a text escaped and embedded in a html element with a class attribute and a style attribute.
*
* The html element used depends on the element type settings of the aFontNode. The html element in the returned result
* will always be a paragraph (<p>) with no class attribute if aFontNode is null
* or not of primary type sv:font.
*
* aStyle will be ignored if it is null.
*
* Some examples:
*
* Method call: getEscapedHtmlText("Hello world! one < two", myFontNode, "padding-left:0.7em")
* will return any of the following:
*
<h1 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h1><h2 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h2><h3 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h3><h4 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h4><h5 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h5><h6 class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</h6><p class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</p><span class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</span><code class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</code><sub class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</sub><sup class="selectorTextOfMyFontNode" style="padding-left:0.7em">Hello world! one < two</sup>Method call: getEscapedHtmlText("Hello world! one < two", null, "padding-left:0.7em")
* will return this:
*
<p style="padding-left:0.7em">Hello world! one < two</p>Method call: getEscapedHtmlText("Hello world! one < two", null, null)
* will return this:
*
<p>Hello world! one < two</p>Method call: getEscapedHtmlText("Hello world! one < two", myFontNode, null)
* will return the same result as if the {@link #getEscapedHtmlText(String, javax.jcr.Node) getEscapedHtmlText(String, Node)}
* method had been invoked.
*
Node of primary type sv:font that determines the type of html element to use and the
class attribute value of the element
* @param aStyle the style that should be inserted in the style attribute of the element
* @return aPlainText embedded in a html element, or empty String if aPlainText is null
* @see #getHtmlText(String, javax.jcr.Node, String)
* @since Sitevision 2.6.1_02
*/
getEscapedHtmlText(
aPlainText: String | string,
aFontNode: Node,
aStyle: String | string
): string;
/**
* Hyperlinks text and uses a specified css class for created anchors.
*
*
* Inserts an hyperlink/anchor (<a href="...">...</a>) with a title and optional class and style where the text seems
* to indicate a hyperlink. Text blocks that starts with http://, https://, www. or contains an @ will be
* considered for hyperlinking.
*
class attribute of the a element).
if aClass is null or empty, it will not be used in any hyperlinks.
* @param aStyle the style of the hyperlinks (the style attribute of the a element)
if aStyle is null or empty, it will not be used in any hyperlinks.
* @return aText hyperlinked
* @since Sitevision 2.6.1_06
* @see OutputUtil#getHyperlinkedText(String)
*/
getHyperlinkedText(
aText: String | string,
aClass: String | string,
aStyle: String | string
): string;
/**
* Hyperlinks text.
*
*
* Inserts an hyperlink/anchor (<a href="...">...</a>) where the text seems to indicate a hyperlink.
* Text blocks that starts with http://, https://, www. or contains an @ will be considered for hyperlinking.
*
aText hyperlinked
* @since Sitevision 3.1
* @see OutputUtil#getHyperlinkedText(String, String, String)
*/
getHyperlinkedText(aText: String | string): string;
/**
* Gets a simplistic plain text output from a text portlet.
* Handles plain text, line breaks and dot lists.
* @param aNode a text portlet node
* @return the output from the text portlet as plain text, or an empty String if aNode is null or not a text portlet
* @deprecated Use {@link #getNodeOutput(javax.jcr.Node, javax.jcr.Node, int)}
* @see #getNodeOutput(Node,Node,int)
*/
getNodeAsText(aNode: Node): string;
/**
* Gets the output as a specific content-type from a page node.
*
* * Note! Due to security reasons (potential never-ending loops) it is prohibited to get the output of * the currently executing page (i.e. {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentPage()})! *
* @param aPageNode a page node (sv:page, sv:article, sv:sitePage) where current user has READ permission, must not be null or "current page". * @param aContentType a content-type marker, i.e. {@link #CONTENT_TYPE_TEXT_PLAIN}, {@link #CONTENT_TYPE_TEXT_HTML} or {@link #CONTENT_TYPE_TEXT_XML} * @return the output result for specified aContentType. If aPageNode is null or "current page", an empty String is returned. If current user doesn't have READ permission on aPageNode, an empty String is returned. * @see #getNodeOutput(Node, Node, int) * @since Sitevision 2025.01.2 */ getNodeOutput(aPageNode: Node, aContentType: number): string; /** * Gets the output as a specific content-type from a page node or a page content node. * ** Tip! This method has three versatile siblings that might be more suitable depending on your use case: *
** Note! Due to security reasons (potential never-ending loops) it is prohibited to get the output of anything from * the currently executing page (i.e. {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentPage()})! *
* @param aPageNode a page node (sv:page, sv:article, sv:sitePage) where current user has READ permission, must not be null or "current page". * @param aPagePartNode a page part node that exist as content on aPageNode (or null if you want the complete output from aPageNode). * @param aContentType a content-type marker, i.e. {@link #CONTENT_TYPE_TEXT_PLAIN}, {@link #CONTENT_TYPE_TEXT_HTML} or {@link #CONTENT_TYPE_TEXT_XML} * @return the output result for specified aContentType. If aPageNode is null or "current page", an empty String is returned. If current user doesn't have READ permission on aPageNode, an empty String is returned. If aPagePartNode is null, the output result of aPageNode is returned. If aPagePartNode doesn't exist as content on aPageNode, an empty String is returned. * @since Sitevision 2.6 */ getNodeOutput( aPageNode: Node, aPagePartNode: Node, aContentType: number ): string; /** * Debug method that returns info about the properties of a node and all its sub nodes. * ** * Note! This method is intended for debugging purposes during development ONLY! * Important: Only the types and properties that are officially specified on the * Sitevision developer web * can be relied upon and used in production. All other types and properties should * be considered volatile. Output produced by this method is not indexed by the Sitevision indexer. * *
* @param aNode the start node from where all properties should be retrieved * @return the node as a {@code String} in HTML or an empty String if it does not contain any properties and sub nodes. * @throws IllegalArgumentException if the given node {@code aNode} is null. * @throws javax.jcr.RepositoryException if something else goes wrong. * @see #getNodeInfoAsHTML(javax.jcr.Node, int) * @since Sitevision 3.0 */ getNodeInfoAsHTML(aNode: Node): string; /** * Debug method that returns info about the properties of a node and all its sub nodes recursively until a given sub level * {@code aDepth} is reached. * ** * Note! This method is intended for debugging purposes during development ONLY! * Important: Only the types and properties that are officially specified on the * Sitevision developer web * can be relied upon and used in production. All other types and properties should * be considered volatile. Output produced by this method is not indexed by the Sitevision indexer. * *
* @param aNode the start node from where all properties should be retrieved * @param aDepth the number of sub levels from the start node to be retrieved * @return the node as a {@code String} in HTML or an empty String if it does not contain any properties and sub nodes. * @throws IllegalArgumentException if the given node {@code aNode} is null or the given depth {@code aDepth} is negative. * @throws RepositoryException if something else goes wrong. * @since Sitevision 3.0 */ getNodeInfoAsHTML(aNode: Node, aDepth: number): string; /** * Convenience method for rendering a linked web path to a specified node. * ** Example: You use Velocity and want to do a simple "path to this page" trail using the * Envision Breadcrumb Component markup. *
* *A) The explicit way:
*Use the getWebPathNodes method of {@link senselogic.sitevision.api.node.NodeTreeUtil} to get all nodes in the
* path to the site page and render a link to each node using a {@link senselogic.sitevision.api.render.LinkRenderer}.
* Current page can be found via a {@link senselogic.sitevision.api.context.PortletContextUtil} instance.
* ## Get all nodes from here to the site page
* #set ($currentPage = $sitevisionUtils.portletContextUtil.currentPage)
* #set ($nodeTreeUtil = $sitevisionUtils.nodeTreeUtil)
* #set ($pathList = $nodeTreeUtil.getWebPathNodes($currentPage))
*
* ## Iterate the nodes in the list with a LinkRenderer
* #if (!$pathList.isEmpty())
* ## Set up the link renderer
* #set ($linkRenderer = $sitevisionUtils.getLinkRenderer())
*
* ## Render links to all nodes
* <nav aria-label="Breadcrumb" class="normal">
* ## Use a list for accessibility (https://envisionui.io/components/breadcrumb/)
* <ol class="env-breadcrumb">
* #foreach ($node in $pathList)
* $linkRenderer.update($node)
* <li class="env-breadcrumb__item">
* $linkRenderer.render()
* #if (!$foreach.last)
* <span aria-hidden="true" class="env-breadcrumb__separator">»</span>
* #end
* </li>
* #end
* </ol>
* </nav>
* #end
*
* B) The convenient way:
*Use the getWebPathNodes method!
* ## Init
* #set ($currentPage = $sitevisionUtils.portletContextUtil.currentPage)
* #set ($outputUtil = $sitevisionUtils.outputUtil)
* #set ($linkRenderer = $sitevisionUtils.getLinkRenderer())
*
* ## Render
* #set ($result = $outputUtil.renderWebPathNodes($currentPage, $linkRenderer, ' » '))
* #if ($result != '')
* <nav aria-label="Breadcrumb" class="normal">$result</nav>
* #end
*
* * For a description of "web path", see {@link senselogic.sitevision.api.node.NodeTreeUtil#getWebPathNodes(javax.jcr.Node)} *
* @param aDescendantNode the node the web path should be rendered for * @param aLinkRenderer the link renderer that determines how links are rendered * @param aSeparator the separator that should be put between the links. Note! This is not encoded by this method. * @return a HTML list of linked web paths, or empty string if aDescendantNode isnull,
aLinkRenderer is null or no web path could be created.
* @see senselogic.sitevision.api.node.NodeTreeUtil#getWebPathNodes(javax.jcr.Node)
* @since Sitevision 3.0.2
*/
renderWebPathNodes(
aDescendantNode: Node,
aLinkRenderer: LinkRenderer,
aSeparator: String | string
): string;
}
declare namespace OutputUtil {}
declare var outputUtil: OutputUtil;
export default outputUtil;