Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I need to replicate Code block macro

DeanF March 22, 2018

We have a large document set with hundreds of copies of an old macro that called the code block macro. The only parameter it specified was the language and we can now set this globally using the "Configure Code Macro" option. The resulting code blocks are not printed properly by the new Scroll PDF Exporter so I want to just call the Confluence code block instead (Scroll PDF Exporter does output those properly). So to avoid replacing hundreds of macros I need to fix our macro. This is the code:

## Macro title: codeblock (generates pre-formatted code block)
## Macro has a body: Y
## Body processing: Rendered
## Output: Selected output option
##
## Installed by: Cherryleaf

## @param Title:title=Title|type=string|desc=Title

<ac:structured-macro ac:name="code"><ac:parameter ac:name="title">$!paramTitle</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:plain-text-body><![CDATA[$body]]></ac:plain-text-body>
</ac:structured-macro>

 

But this is the storage format it produces (it inserts the <pre>, inserts INLINE instead of BLOCK, and changes the body from plain-text to rich-text):

<p><strong>next</strong></p><ac:structured-macro ac:name="hcc-testcodeblock" ac:schema-version="1" ac:macro-id="77650f5f-d141-4737-87d4-2e21d920cedd"><ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:rich-text-body>
<pre>long f_read (
    void *     buf,
    long       size,
    long       size_t,
    F_FILE *   filehandle )</pre></ac:rich-text-body></ac:structured-macro>

 

Any suggestions gratefully received. Thanks

Dean

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events