Rendering frameworks

There are two frameworks that do the template rendering in Confluence: Webwork and Sitemesh. The confusing bit is that both of them use Velocity as their templating engine. We try to distinguish them by using *.vm for templates processed by Webwork, and *.vmd for those processed by Sitemesh.

Rendering contexts

There are four different Velocity contexts used in Confluence:

The two Sitemesh contexts are pretty much the same, but the Webwork velocity context contains a lot more stuff than either of the Sitemesh ones.

Rendering pipeline

So the general flow of control goes:

You can find out which beans are in which context by looking in the classes above. A full list would be too long to include here. Note that even though the ApplyDecoratorDirective launches a Sitemesh decorator template, the Sitemesh template doesn't get automatic access to the Velocity context. The only bits that are passed through are done with the #decoratorParam() directive.

Wow, pretty complicated. But it lets us do cool stuff like implement custom themes, apply layouts and more.