Hi, hoping for some advice regarding an issue we are experiencing with a couple of user macros following a recent Confluence upgrade.
We use two macros in tandem:
1 Multi-excerpt
2 Include Multi-excerpt Much like the generic excerpt macros already provide by Confluence, these macros allow us to reference multiple excerpts from a single page in Confluence.
These worked fine up until we upgraded Confluence to 8.8.1. We now find that any macro previously used is no longer being presented in the "Include Multi-excerpt" macro component added to the destination page. We receive no errors either, it is just not visible.
This affects all users, across different browser types. We have reached out to Atlassian who have not been able to provide an answer as to why the macro would stop working following the upgrade. Has anyone seen issues with user macros following an upgrade?
multi-excerpt code:
## Creates an Excerpt section
## @Param Name:title=Excerpt Name|type=string|required=true|desc=Name used to identify the excerpt.
<div id="excerpt-$paramName">
<p>$body</p>
</div>
include multi-excerpt code:
## Include page content, identified by a multi excerpt
## @Param Page:title=Excerpt Page|type=confluence-content|required=true|desc=The page where excerpt is to be taken from (must the same Space).
## @Param Name:title=Excerpt Name|type=string|required=true|desc=Name of the excerpt on the page specified.
## @Param Highlight:title=Highlight Excerpt|type=boolean|default=true|required=true|desc=Highlight excerpt to show origin on mouse hover.
## Get container variables (which maybe used)
#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
#set($pageManager = $containerContext.getComponent('pageManager'))
## Get Page where excerpt exists
#set ($page = $pageManager.getPage($space.key, $paramPage))
#set ($excerptNotFound = true)
#if ($page)
#set ($bodyContent = $page.getBodyAsString())
#set ($excerptStart = '<ac:parameter ac:name="Name">' + $paramName + '</ac:parameter>')
#set ($start = $bodyContent.indexOf($excerptStart) + $excerptStart.length())
#if( $start > $excerptStart.length() )
#set ($excerptEnd = '</ac:rich-text-body></ac:structured-macro>')
#set ($end = $bodyContent.indexOf($excerptEnd, $start))
#if( $end > ($excerptStart.length() + 1) )
#set ($excerptHtml = $bodyContent.substring($start, $end))
#if ( $paramHighlight == true )
<style>
.excerpt-hover .tooltiptext {
visibility: hidden;
width: 300px;
margin-top: 1px;
top: 100%;
background-color: #DFE1E6;
color: #fff;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 5px;
outline: 1px solid #DFE1E6;
position: absolute;
z-index: 1;
}
.excerpt-hover {
outline: none;
position: relative;
display: inline-block;
}
.excerpt-hover:hover {
outline: 1px solid #DFE1E6;
border-radius: 4px 4px 4px 0px;
}
.excerpt-hover:hover .tooltiptext {
visibility: visible;
}
</style>
<div class="excerpt-hover">
#end
$excerptHtml
#if ( $paramHighlight == true )
<span class="tooltiptext"><a href="$page.getUrlPath()">$paramPage ($paramName)</a></span>
</div>
#end
#set ($excerptNotFound = false)
#end
#end
#end
#if ($excerptNotFound)
<p>Cannot find excerpt named <b>$paramName</b> on <b>$paramPage</b>.</p>
#end
Atlassian deprecated $pageManager.getPage and $pageManager.getPages. As far as I can see there isn't a way now in a user macro to get an arbitrary Page object. Were you able to find a way around this?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.