Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Upgrading a very simple macro from Confluence 3.5 to 4.0

Deleted user August 28, 2013

I have a very basic macro that is used on many, many pages in our Confluence 3.5 instance. I've read this page: Upgrading and Migrating an Existing Confluence Macro to 4.0 which is all very well for complicated macros that have been created as plugins.

My little macro was created entirely in the User Macro admin screen. It wraps a paragraph of text and displays a toc over on the right side of the page to save space.

The settings are:

  • Macro body processing: Render HTML
  • Output format: wiki markup
  • template:
{section}{column:width=60%} 
$body 
{column}{column} 
{panel:bgColor=#FFF2F0|borderColor=white}{toc:style=circle|maxLevel=3}{panel} 
{column}{section}

and that's it.

My question is: do I have to go through all that rigmarole of creating a plugin (creating XML files and building a jar) in order to test a migration from 3.5 to 4.x to 5.x ?

3 answers

1 accepted

0 votes
Answer accepted
Amalia
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.
August 28, 2013
<ac:macro ac:name="section">
  <ac:rich-text-body>
    <ac:macro ac:name="column">
      <ac:parameter ac:name="width">60%</ac:parameter>
      <ac:rich-text-body>
        <p>$body</p>
      </ac:rich-text-body>
    </ac:macro>
    <ac:macro ac:name="column">
      <ac:rich-text-body>
        <ac:macro ac:name="panel">
          <ac:parameter ac:name="bgColor">#FFF2F0</ac:parameter>
          <ac:parameter ac:name="borderColor">white</ac:parameter>
          <ac:rich-text-body>
            <p>
              <ac:macro ac:name="toc">
                <ac:parameter ac:name="style">circle</ac:parameter>
                <ac:parameter ac:name="maxLevel">3</ac:parameter>
              </ac:macro> </p>
          </ac:rich-text-body>
        </ac:macro>
      </ac:rich-text-body>
    </ac:macro>
  </ac:rich-text-body>
</ac:macro>

You can add the above code to your Confluence 4.x user macro :) Ensure that the Macro Body Processing option is set to "Rendered"

How did I do this?

  • Create a new page, click Insert > Wiki Markup
  • Copy and paste your previous user macro template
  • Save the page
  • View the Storage Format (Tools > View Storage Format)

Amalia
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.
August 28, 2013

the point on doing the above is that, Confluence 4.x and above user macros do not use wiki markup anymore. So we need to use the equivalent of XHMTL code for that.

Deleted user August 28, 2013

Thank you very much, Amalia. I'm a wiki-markup virtuoso, but I haven't had time to teach myself Confluence-flavoured XHTML. I appreciate your help with this.

0 votes
Deleted user October 17, 2014

Update 1 - ensuring it appears in the macro browser

I've since learned that adding this line to the top of the code means the macro will be displayed in the macro browser, otherwise it doesn't appear.

## @noparams

Update 2 - it no longer recognises headings

But now I've got another problem with this macro. When it was built using wiki markup, you could have up to 3 levels of headings inside the left column, and they would appear in the table of contents in the usual way.

But if you use the macro as written above, headings don't render after you save the page. They're perfectly visible and formatted correctly while you're editing the page. But once the page is saved, the headings (a) disappear as if they don't exist and (b) are not in the table of contents.

This means the macro has lost functionality and I will have to manually edit 50+ pages to restore the headings that were in them.

So I've reverted back to the wiki-markup version of the macro. Any thoughts on why that might be happening?

 

0 votes
Deleted user August 28, 2013

To clarify - after migrating, will I be able to recreate that macro in the Admin screen in 4.0 in the same way as I created the original?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events