Confluence Macro Collection

We are currently evaluating xWiki because Atlassian is not interested in their customers anymore…

On a first attempt to import one of our smaller Wikis into a xWiki test installation we noticed that we used lots of Confluence macros which do not exist in xWiki.

Is there a Confluence macro collection for xWiki to make migration easier?
Or a plan to create one?

I started to recreate the “status” macro (in a hacky way) as first step.

status-macro:

{{velocity}}
#set ($colour = $wikimacro.parameters.colour)
#set ($textcolour = "#ffffff")

#if ($wikimacro.parameters.colour == "Yellow")
  #set ($colour = "#ff991f")
  #set ($textcolour = "#172b4d")
#end

{{html}}
    <div style="background:$colour; color:$textcolour; padding:3px 5px 3px; min-width: 86px; text-align:     center; text-transform: uppercase; display: inline-block; font-size: 11px; font-weight: 700; line-height: 1;      margin: 0; border-radius: 3px;">
      $wikimacro.parameters.title
    </div>
{{/html}}
{{/velocity}}

:wink:

Yes that’s a good idea. Ludovic has started a discussion at https://forum.xwiki.org/t/contrib-repository-for-confluence-macros-and-tools/7711

Would be awesome to contribute your status macro there.

@ludovic What’s your status on this topic?

Note that we support a color type for wiki macro parameters so that you get a color picker to pick the color in the WYSIWYG editor. See https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/WikiMacroTutorial/#HParameters

You’ll get something like:

Screenshot 2021-01-05 at 17.00.59

Also you should use the macro content instead of a title parameter for the content, see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/WikiMacroTutorial/#HContent

Thanks

The confluence macro will only a very limited set of colors. The text color will then depend on the choosen background color.

I didn’t find a way to offer a predefined list of values yet.

Each macro parameter can have a default value, see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/WikiMacroTutorial/#HParameters

Or do you mean something else?

If you wish to only support a specific hardcoded list of supported values and you’re coding this as a wiki macro (and not as a java macro) then indeed the only solution I know is to use a String (and perform the validation in velocity), but then you won’t get autosuggest/autocompletion in WYSIWYG. To get that would be more complex, you’d need to do it in java and introduce some custom type and picker.

Would be good to create a jira for this need, I think it’s a common need that is interesting.

Thanks

Hi, sorry for the delay in responding to this topic. I thought that it deserved a longer answer so it needed some more time to prepare it.
I’ve posted an article in the forum explaining our plans for the Confluence Importing Tools and macros. I realize this is not necessarily what you would have like to see.

We will be doing the work in this repository: https://github.com/xwikisas/macros-confluence
It might change name later on.
We did a first Status macro. You can try to build the repository and import the macro in your wiki if you would like to try it out.

Ludovic