Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to search directly on XHTML or Storage Format?

Brendan Patterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2016

I am trying to see if there is way to enter a Confluence search query which finds pages containing a macro with specific parameters.  

Partial solution:  This actually still seems to work from a way back article by Sarah Maddox in so far as one can search:  macroName: x*

https://ffeathers.wordpress.com/2011/11/04/how-to-search-confluence-for-usage-of-a-macro/

 OR  another helpful solution would be how to create something like a regex which searches XHTML or Storage Format for Confluence pages matching the criteria.

Thank you for any insights!!

2 answers

0 votes
Stephan Sutter
Contributor
January 27, 2016

Hi Brendan,

If you are willing to wirte a plugin, this is the code snippet to find macros and their parameters:

 

    MacroDefinitionHandler macroDefinitionHandler = new MacroDefinitionHandler() {

        public void handle(MacroDefinition macroDefinition) { 

            String macroName = macroDefinition.getName();                

            if (macroName != null && macroName.equals(MACRO_NAME)) { 

                buttonCaptions.add(macroDefinition.getParameter(PARAM_CAPTION));

            }            

        }

    };

    try {

        xhtmlContent.handleMacroDefinitions(pageInStorageFormat, conversionContext, macroDefinitionHandler);

    }        

    catch (XhtmlException e) {

        throw new PtcException("Couldn't extract button name from MACRO_NAME.",e);

    }

 

I hope this gives you a good starting point.

Regards,
Stephan

0 votes
Chii
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 27, 2016

you can try using CQL to search for uses of macros (see https://developer.atlassian.com/confdev/confluence-rest-api/advanced-searching-using-cql#AdvancedSearchingusingCQL-macroMacroMacro), but that doesn't let you specify the parameters unfortunately.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events