projectdoc Toolbox

Alter the rendering of macros of transcluded content with remote controls.

Audience
Type
Level of Experience
Expected Duration
10 mins

This tip shows how to alter the rendering of transluded content by the example of the Display Table Macro based on Remote Controls.

So you can not only transclude content, have its heading level altered according to the new context, but also alter the rendering of macros in the transcluded content. This gives you even more control to adjust the transcluded content to meet the requirements of the transcluding context.

The Remote Controls feature was introduced for the projectdoc Toolbox for Confluence version 4.5.

Task

Suppose you have pages with references you want to collect and render in a table.

For this example we use the Online Manual for the projectdoc Toolbox and want to render the name, short description, and referenced documents with the Display Table Macro.

These are the documents we want to transclude from:

  1. Tours
  2. Topics
  3. FAQs


Requirements

To grab information from these three documents, two requirements must be met:

  1. The table of references is required to be selectable
  2. The display table macros require an identifier of tag

Let's see how we meet this requirements!

Selectable Table of References

In our task we want to select the name and short description as properties and the table of references, which is part of the document body. The table of references is part of a Section Macro and therefore selectable. But we do want to have the table alone without the introduction text.

Therefore the table needs to be wrapped inside a Content Marker Macro with identifier documents (the identifier may be any character sequence).

Content Marker Macro with Identifier Parameter set to 'documents'.

Since the Display Table Macro renders each property and section in a column identified by the name or title – in our case identifier – we need to make sure that the identifier provided to the Identifier Parameter of the Content Marker Macro has the same value in all three documents.

Selectable Display Table Macro

In order to remote control the Display Table Macro the macro requires to be identifiable. This can be done by either providing a value to the Identifier Parameter or the Identifier Classes Parameter.

We decide to provide the identifier references.

The Identifier Parameter of the Display Table Macro is set to 'references'.

Transclusion and Remote Controls

Using a Display Table Macro to render the name, short description and documents property has per default the following result:

Result of the Display Table Macro

We use Name, Short Description, documents for the Select Parameter and translate documents to References (documents=References) by the use of the Header Translations Parameter.

The problem is that the documents are rendered differently in the three locations. In this view we need to have a unified format. The unified format should only render the name and short description. We also want – since the value is rendered in a table cell – the list of references be rendered as a definition list and not as tables.

We use the Remote Control feature and are able to control all three transcluded macros by the use of the identifier references (as we have shown in the Requirements section above).

We set the Remote Controls Parameter to 

references:select=Name, Short Description&references:render-mode=definition

What does this mean?

references is the identifier of the macros we want to remote control. We set the Select parameter to Name, Short  Description. Not only do we want to have each cell render the same properties, but also a definition list is only rendered in case there are only two properties selected.

The second control is adjusting the Render Mode to definition, which will render the table as a definition list.

So this is the result:

The Display Table with normalized References Column

In case you want to collapse the Name and Short Description columns, use a Template as a value for the Select Parameter.

#T\{$[Name]<br/>${Short Description}\}, documents

Note the backslashes (\). They are necessary because of an issue with the macro editor. It has difficulties parsing values with curly braces. The backslash escapes it properly, so the macro editor will close successfully.

We also need to translate the name of the template T to Name. So the Header Translations read like this:

documents=References, T=Name

So this is the result (only the first row shown):

Result of using a Template to render Name and Short Description in one Column

Conclusion

We have shown how the result of a Display Table Macro can be rendered more concise.

By the use of Remote Controls we turned tables in different format into a definition list. By the use of a Select Template we collapsed the first two columns into one.

The focus of this tip is on using Remote Controls. It requires some configuration on the part of the transcluded content. The use of transclusion should be already considered when designing the information architecture. But – if the user has write access to all transcluded content – we have shown that adjusting the content is not too difficult.

Resources

Display Table Macro
Lists references to projectdoc documents in a table. Allows to select document properties for columns. Also non-list representations are provided.
Content Marker Macro
Marks a piece of content within a document. This content can be referenced for transclusion.
Section Macro
Renders a section, if the body is not empty. Supports authors to create content, clutter-free rendering without empty sections. Allows to transclude the content.
Transclusion
Tools to provide or consume content to support reuse.
Remote Control
Changing the rendered contents of a projectdoc document dynamically for each request.
Remote Controls
Remote controls are sequences that allow to configure macros in transcluded content. This reconfiguration alters the rendering result of the macro. Only macros supporting the remote control feature can be remote controlled.
Heading Level Transposition
Reusing sections typically includes the transcluded content to match the document structure of the transcluding document. The projectdoc Toolbox does this automatically.