You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

This page describes a way of allowing arbitrary Confluence content, including macros, in the bodies of macros that don't normally allow this.

Introduction

Confluence macros can be nested within other macros. For instance, the chart macro can take a static table as input:

MacroResult
Bar chart

But it can also take output from a SQL macro:

MacroResult
Bar chart

(or CSV, or any other table-generating macro)

This plugin composability allows very powerful combinations. Like Unix pipes, one macro fetches data and feeds it to another.

 

This is great, but only works when the macro in question was designed to accept the "rich text" XHTML generated by another macro. The chart plugin can have a nested macro, but the SQL Query plugin can't, for example.

Use-cases

Why would we want to send dynamic content to a macro not expecting it? Here are a few situations:

  • You write a param macro that returns a HTTP parameter from the URL, and want to use it to parametrize a SQL query.
  • You want to use SQL results in Javascript in a html macro.

The solution

The solution is to create a wrapper macro that accepts rich text as input,  converts it to plain text

 

 

 

 

  • No labels