Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Document Properties Marker
overridefalse
Short DescriptionThe projectdoc Toolbox provides an interface for template authors to replace placeholders with space and context properties.
 

Doctypetopichide
NameVariables for Blueprints
 

Parent
Parent Property
propertyParent
property-nameName
 

Audience
Name List
doctyperole
render-no-hits-as-blanktrue
render-list-as-comma-separated-valuestrue
namesTemplate Author, Documentation Architect
propertyAudience
empty-as-nonefalse
 

Level of Experience
Name List
doctypeexperience-level
render-no-hits-as-blanktrue
propertyLevel of Experience
 

Expected Duration30 min
 

Subject
Name List
doctypesubject
propertySubject
 

Categories
Name List
doctypecategory
propertyCategories
 

Tags
Tag List
propertyTags
 

Iteration
Iteration
valuefilled
hide
Type
Name List
doctypetopic-type
render-no-hits-as-blanktrue
namesTutorial
propertyType
empty-as-nonefalse
 

Sponsors
Name List
doctypestakeholder
render-no-hits-as-blanktrue
propertySponsors
 

Sort Keyhide
Section
show-titlefalse
titleDescription

When a page author creates a page with a blueprint wizard, the template author may want to speed up page creation by providing some useful default values for the wizard or the generated page. The default texts may rely on information from the current context (such as the current date or user creating the page) or the space the page is part of (such as the name or the version of the product).

The PDAC1 supports to replace these placeholders.

...

Section
titleReplace in Wizard

Template authors may need to prefill the input fields of a wizard's form. For text fragments containing placeholders the projectdoc Toolbox provides a service to replace those placeholders with context or space property values.

The service is located at /plugins/servlet/projectdoc/toolbox/resolve. It provides the following parameters

ParameterDescription
templateThe string template with placeholders to replace.
spaceKeyThe key to the space whose properties are used to replace placeholders.
pageIdThe identifier of the page (long) or a page reference of the format spaceKey:pageTitle (where the space key is optional and defaults to the spaceKey parameter of the service.

The following context information can be accessed by specifying a placeholder in the template string and passing it to the service.

Definition List
currentDate
The current date, formatted by the Confluence date formatter.
currentTime
The current time, formatted by the Confluence time formatter.
currentDateToken
The current date, formatted with yyyy-MM-dd.
currentUserId
The login name of the user creating the page.
currentUser
The full name of the user creating the page.
currentUserEmail
The email address of the user creating the page.
Example Box
titleString Template with Placeholders: Context Properties
Code Block
New report by ${currentUser} on ${currentDate}

To access space properties, simply specify the name of the property you need to be resolved.

Example Box
titleString Template with Placeholders: Space Properties
Code Block
New Release V${Version} for ${Product Name}

On success (code 200) the template's placeholders are replaced or removed, if no valid for them is found.

Example Box
titleService Call from JavaScript

The following snippet is an example on how to access the service and replace the content of an input field of a wizard's form.

Code Block
languagejs
wizard.on('pre-render.page1Id', function(e, state) {
  var template = encodeURIComponent("New report by ${currentUser} on ${currentDate}");
  var url = AJS.contextPath()
             + "/plugins/servlet/projectdoc/toolbox/resolve?template="
             + template + "&spaceKey=" + state.wizardData.spaceKey;
  AJS.$.ajax({
    url: url,
    success: function(data, status) {
                if(status === 'success') {
                    state.soyRenderContext['name'] = data;
                }
            },
    async: false
  });
});

If a placeholder cannot be replaced, it is removed. The template author may define a scope by curly brackets. If at least one of the placeholder within such a scope is not replaced, the whole scope is not rendered.

Example Box
titleTemplate with a Scope
Code Block
languagetext
New report{ (Version ${Version})}

Without the scope the template (with an unresolved version placeholder) would be resolved to New Report (Version ), but with the scope the result is New Report.

...

Section
titleResources

More information for template authors.

Tour
render-as-definition-listtrue
replace-title-with-nametrue
 

Tour for Template Authors
 

Translate Placeholders in Short Description
 

Page Wizard Placeholder