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

Compare with Current View Page History

« Previous Version 11 Next »

projectdoc Toolbox

Transcludes content from a document marked with the content marker macro and renders it as plain text.

The Transclusion To Text Macro includes content from another page at render time and renders it as plain text. Transclusion supports single sourcing.

Since not every environment permits the transclusion of content as plain text due to security considerations, this macro is disabled by default.

This is similar to the Transclusion Macro. The Transclusion Macro, in contrast to this macro, renders the content with target format HTML. Therefore use the Transclusion To Text Macro if you need to process the transcluded content (e.g. with the Body Graph Macro).

The content to be transcluded has to be marked as a section (Section Macro) or region content (Content Marker Macro).

 

Transclusion only works with plain Confluence pages since version 1.11 of the projectdoc Toolbox.

Before that version only transclusion from projectdoc documents was defined. Creating a projectdoc document is simple: add the Document Properties Marker Macro. No special properties required.

The body provides space for replacements of the form "placeholder=replacement", each on its own line. Specify a placeholder like this ${placeholderName}.

Details

Remote Controlled Documents

 

Remote Controlled Documents are available since version 2.0 of the projectdoc Toolbox.

Remote Controlled Documents allow to control the content at request time. A HTTP  request may override parameters of the transclusion macro. A request parameter addresses a transclusion macro by its identifier. After the identifier the name of the parameter is appended, separated by a colon.

Override Parameters

 

Assume that the identifier of the transclusion macro is set to 'my', the following call will override the document and ids parameter on the page 'MyPage' in space 'MYS'.

confluence/display/MYS/MyPage?my:document=b2&my:ids=Description

Also the body can be overridden to replace placeholders in the transcluded fragments.

Override Body

 
body=Placeholder1%3DMyValue1\nPlaceholderX%3ValueB

The list of parameters allowed to override:

  • document
  • ids
  • tags
  • select
  • taget-heading-level (yes, the 'r' is missing!)
  • render-document-name-as-heading
  • apply-document-properties
  • render-error-on-no-content
  • remove-template-buttons

Since 3.1

 

Since version 3.1 these parameters can also be controlled by the context of the macro.

Search Transcluding Pages

To search for pages that transclude information from a given document, use the following search syntax:

macroName:projectdoc-transclusion-macro* AND ("{Title of transcluded page}")

This will return all pages that are using the transclusion macro and have the title on their page content.

 

Using How to search for macros and macro parameters in Confluence 4 would be better, but it did not work out of the box.

If you are using documentation modules, the pages transcluding the module will be displayed automatically.

Transcluding Content with identical Titles

If you have a document with identical titles, it is still possible to transclude the individual sections. Confluence ensures that each heading on a page is unique. This is required by the HTML 5 standard. projectdoc use this service to also make sections unique. Therefore a title that occurs a second time on the same page is suffixed with '.1'. The next with '.2', '.3', and so on.

Here is the page with two sections titled 'Content'.

Here is the macro editor selecting the content of the second section titled 'Content' by selecting on 'Content.1':

Activate Macro

To activate the macro an administrator needs to go to the Add-on page.

Here activate the macros for use by Confluence users:

  • projectdoc-transclusion-to-text-macro - used as a standard macro
  • projectdoc-transclusion-to-text-macro-curly - used in context where Confluence Wiki Markup is required

Confluence Wiki Markup

 

In both use cases the name of the macro projectdoc-transclusion-to-text-macro is used.

Related macros

Name Short Description Notes
Transcludes content from a document marked with the content marker macro.
To use for transclusion that needs not to be rendered as plain text.
Marks a piece of content within a document. This content can be referenced for transclusion.
Allows to mark a content with an identifier or tags.
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.
Similar to the content marker macro, but also allows to set a heading.
Renders transcluded content fetched from documents of a result set.
To transclude from documents selected by a query.

  • No labels