After careful consideration, Wiki Markup for Confluence will be retired and archived on the Atlassian Marketplace on December 26, 2023. Current customers and evaluators were informed of this change on September 27, 2023. Please contact our support team if you have any opinions.
How to automate adding wiki macro to pages
Description
If you are migrating from Confluence 3.x and want to retain wiki markup on some specific pages, then here is a quick way to do so. The key is knowing what contain you want to retain as wiki markup. Often, pages can be identified by what macros are on the page. The following will use this case as an example, but really any Confluence search terms can be used.Â
This is for Confluence 3.x only
This needs to be done before migrating !!!
Be careful, test first
Whenever using automation that could affect a large number of pages, be very careful and test on a test space or test instance. It is hard to undo most source changes.
Figure out quote escaping for your OS
See Tips.
References
Dependencies
- Wiki Markup for Confluence - installed on both Confluence 3.x before migration and also on Confluence 4.x/5.x after migration.
- Confluence Command Line Interface (CLI)
Steps
Determine your search criteria to find pages. Verify the UI finds the right pages.Â
ExampleExample: "{macroname" NOT "{wiki}".
Construct an appropriate runFromContentList command similar to: How to globally search and modify contentÂ
Example--action getContentList --search " \"{macroname\" NOT \"{wiki}\" " Â --action runFromContentList --search " \"{macroname\" NOT \"{wiki}\" " --common " ... "
Test the modifyPage action on a test pageÂ
confluence --action modifyPage --space xxx --title test --content "{wiki} \n " --content2 " \n {wiki}"
Construct the combined command similar to: How to globally search and modify contentÂ
Exampleconfluence --action runFromContentList --search " \"{macroname\" NOT \"{wiki}\" " --space @all --common "--action modifyPage --space @space@ --id @pageId@ --content \"{wiki} \n \" --content2 \" \n {wiki}\" "
Alternatives
For people comfortable with SQL and having access to the Confluence database, runFromSql can be used as an alternative to find all the pages that need to be modified. There is a runFromSql example on How to automate adding text to Confluence pages. Here is some example SQL:
select contentid from bodycontent, content where contenttype = 'PAGE' and version = (select max(version) from content as c where c.title = content.title) and bodycontent.body like '%name="table-plus">%'
Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.