Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Confluence macros can be nested within other macros. This allows very powerful combinations, like Unix pipes, where one macro fetches data and feeds it to another. A good example is the chart macro, which accepts tabular data from any source: a static table, CSV, SQL, or anything else returning tabular data:For instance, the chart macro can take a static table as input:

MacroResult
 Confluence MarkupResults
Static content
Chart
dataOrientationhorizontal
typebar
PluginDownload Count
WhizzPlugin1000
BangPlugin990
ZippyPlugin600
AnotherPlugin500

But it can also take output from a SQL macro:

MacroResultSQL-generated content
Chart
dataOrientationhorizontal
typebar

(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