There is 1 update.
 
 
Confluence / cid:jira-generated-image-avatar-aad41537-c8e1-4f6e-97ca-4587b162e775 CONFLUENCE-549 Open

Convert Refined's divbox macro to a group, keeping its class and style

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-d7646dd0-2f9d-43bf-b28a-d105d9097f77 Changes by Christophe CN on 12/Nov/26 14:58
 
Description: The divbox macro of Refined for Confluence wraps rich content in a <div> with free "class" and "style" parameters.

It is currently not converted: it is kept as confluence_divbox, which no macro provides, so the page shows "Unknown macro: confluence_divbox" and the whole content of the box (text, images, links, nested divboxes) is not displayed at all.

It is widely used in the Confluence we are migrating (about 1,800 pages).

97% have a "style" (colours, margins, borders, font), none has a "class".

10% are nested in another divbox and 10% in a tab.

Keeping "style" is therefore what matters for us.

*Input* (storage format):
{code:xml}
<ac:structured-macro ac:name="divbox" ac:schema-version="1">

<ac:parameter ac:name="style">border:5px solid red; background:yellow;</ac:parameter>

<ac:parameter ac:name="class">testclass</ac:parameter>

<ac:rich-text-body>

    <p>Some content</p>

    <ac:structured-macro ac:name="divbox" ac:schema-version="1">

      <ac:parameter ac:name="style">border:5px solid blue;</ac:parameter>

      <ac:parameter ac:name="class">highlight</ac:parameter>

      <ac:rich-text-body><p>Nested content</p></ac:rich-text-body>

    </ac:structured-macro>

</ac:rich-text-body>

</ac:structured-macro>

{code}
*Current output* (9.96.7):
{code:java}
{{confluence_divbox style="border:5px solid red; background:yellow;" class="testclass"}}

Some content

{{confluence_divbox style="border:5px solid blue;" class="highlight"}}

Nested content

{{/confluence_divbox}}

{{/confluence_divbox}}

{code}
{*}Proposed output{*}:
{code:java}
(% class="confluence_divbox_content testclass" style="border:5px solid red; background:yellow;" %)

(((

Some content

(% class="confluence_divbox_content highlight" style="border:5px solid blue;" %)

(((

Nested content

)))

)))

{code}
{*}Proposed implementation{*}: MacroToContentConverter already converts ul, legend, tableenhancer, footnote, etc. to a group, but only keeps "id" and "class".

I suggest a DivboxMacroConverter (hint "divbox") extending it and also keeping "style"; any other parameter would be reported with markUnhandledParameterValue.

Alternatively, "style" could be kept by MacroToContentConverter for all its hints, if you prefer.

{*}Questions before we start{*}:
# Is a conversion of divbox already planned or done elsewhere (e.g. in a non-public module)?

# Is keeping "style" on the group fine with you?

# Do you prefer a dedicated converter or a change in MacroToContentConverter?

We are willing to provide the pull request, with a filter test (divbox.test) covering class + style, style only, nested divboxes, rich content and no parameter.