Insert a macro with cli following another macro


it is possible to insert a macro into a page with the confluence command line interface.

(e.g. confluence --action modifyPage --id "216597104" --content "<ac:macro ac:name=""unmigrated-inline-wiki-markup""><ac:plain-text-body><![CDATA[{wiki:param1=xxxxx}bodyText{wiki}]]></ac:plain-text-body></ac:macro>" --noConvert )

But: --content or --content2 puts the content at the end or at the beginning of a page, but I want it to be following another macro, that is somewhere in the midst of the page.

I ve already tried using findReplace, which drives me mad with the special characters, and it doesn t work yet.

Any other ideas?

3 answers

1 accepted

This widget could not be displayed.

Write a small script that does the following:

  1. Run getPageSource
  2. Modify the source according to your specific needs
  3. Then storePage

Thanks Bob for your quick answer and suggestion.

This widget could not be displayed.

Hi @Bob Swift [Bob Swift Atlassian Add-ons], is this possible to do it for a result of runfronlist or getcontentlist? 

Yes, but only if there is no manual intervention required - that means being able to do it generically with *modifyPage*.

This widget could not be displayed.

Yeah it's what i'm trying to do, but i need to add at the end some rows (around 10) corresponding to storage format of 2 different macro (checklist and pageinclude)

Thanks, i figured out, i was missing the "--noConvert" parameter

@Bob Swift [Bob Swift Atlassian Apps]  problem with quote annidation... 


--action runFromContentList --cql "type=page and label=mylabel"  --common ' --action modifyPage  --id "@pageId@" --content2 "<p> <ac:structured-macro ac:name=~include~> <ac:parameter ac:name=~~> <ac:link> <ri:page ri:content-title=~_ page to be included~ ri:space-key=~KB~/> </ac:link> </ac:parameter> </ac:structured-macro></p>" --noConvert --minor --special " #  ~" '



without the runfromcontentlist it works, but when i put it together it doesn't

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

625 views 8 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you