Hi,
Im working on a script listener that need to auto create a page with unknown number of MultiExerpts Include macros (the listener runs aftar 'lable added' and reads the data from the page related to the event - contains excerpts).
Im having a problem to create the new macros and my assumption is that i need to generate macro id for each.
Waiting for your advise
for(def m=0; m < MultiExcerptNames.size(); m++){
def Temp = '<p><ac:structured-macro ac:name="multiexcerpt-include" ac:schema-version="1" ac:macro-id="2d136aa1-2a89-4d59-a9d3-407d20467b21"><ac:parameter ac:name="MultiExcerptName">pub_domain_model</ac:parameter><ac:parameter ac:name="PageWithExcerpt"><ac:link><ri:page ri:space-key="TM" ri:content-title="test" /></ac:link></ac:parameter></ac:structured-macro></p></ac:layout-cell><ac:layout-cell><p><br /></p></ac:layout-cell></ac:layout-section></ac:layout>'
Temp = Temp.replace('ri:content-title="test"', 'ri:content-title="'+MicroServicePage.title.toString()+'"')
Temp = Temp.replace('2d136aa1-2a89-4d59-a9d3-407d20467b21',(MacroId) new MacroId)
Temp = Temp.replace('ac:name="MultiExcerptName">pub_domain_model</ac:parameter>', 'ac:name="MultiExcerptName">'+MultiExcerptNames[m].toString()+'</ac:parameter>')
Temp = Temp.replace('ri:space-key="TM"', 'ri:space-key="'+MicroServiceSpace+'"')
TechPubPageContent = TechPubPageContent + Temp.toString()
}
def TechPubPage = new Page(title: MicroServicePage.title , bodyAsString: TechPubPageContent ,space: TechPubSpace , parentPage: parentPage)
pageManager.saveContentEntity(TechPubPage, DefaultSaveContext.DEFAULT)
pageManager.saveContentEntity(TechPubPage, DefaultSaveContext.MINOR_EDIT)
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.