Extensions :: Miscellaneous

Loading Properties

PropertiesLoader is a 'source-class' compatible helper class that can load a properties file and add or overwrite the request properties by the properties contained in the file.

Usage:
%{include|source=template.vm|source-class=org.tinyjee.maven.dim.extensions.PropertiesLoader|properties=props.(xml|properties)}
or when using the alias:
%{include|source=template.vm|source-properties=props.(xml|properties)}

Parameters:

Parameter Name Description
Input Parameters (set with the macro call)
"source-properties" Defines a shortcut for the request properties 'source-class' and 'properties'.

If this parameter is present inside the request parameters list, the system will effectively behave as if 'source-class' and 'properties' where set separately.
"properties" Sets the path to the properties file to load inside the request parameters.

The specified file is retrieved in exactly the same way as if the "source" parameter would have been used (see Macro reference).

Note: Properties can use the traditional .properties or the newer .xml format. Format selection is performed by file extension.
Output Parameters (set by the extension)
"loadedProperties" Is filled with the loaded Properties instance.

Note: All loaded properties are exposed in the standard scope as request properties and are accessible like any other parameters specified with the macro call.
This additional map based access allows to query properties whose names are not compatible with the variable naming scheme and it also allows to iterate all loaded properties using $loadedProperties.entrySet().
"loadedPropertyKeys" Is filled with a sorted, regex-enabled list of property keys (= new SelectableArrayList<String>(new TreeSet<String>(properties.keySet()));).
Note: Output parameters are set when this extension is used and can be accessed from velocity templates using $nameOfOutputParameter
Implementation "org.tinyjee.maven.dim.extensions.PropertiesLoader": ApiDoc | Source

Inline CSS Definition

This extension adds an inline CSS definition to the current page. Use this extension to define short-lived style classes or adjust existing styles for just one page.

Parameters:

Parameter Name Description
Input Parameters (set with the macro call)
"inline-css" Enables this extension and sets the content to place inside the inlined "<style>" element.

Note: Setting this property has no effect in case of "source" or "source-class" were specified with the macro call. This behaviour ensures that the parameter "inline-css" can still be used with ordinary macro calls where a source or source-class was set.

Using this parameter has no effect when the used Sink does not support HTML markup.

This parameter supports the usage of "classpath:/path/to/css/to/inline" to load the css from the classpath instead of defining it with the macro call.

As the default brace style of "{}" is used to call macros in APT, the extension supports substituting the default CSS braces with "[]". This brace style is optional but it must be used when more than one style class is defined with the macro call as the APT parser swallows the "}" character, leading to invalid results.

Examples:
  • "%{include|inline-css=.my-class { background-color:red; }}"
  • "%{include|inline-css=.section th { background-color:#999999; color:white; }}" - changes the appearance of table headers inside sections.
  • "%{include|inline-css=.white [ color:white; ] .red [ color:red; ]}" - Define more than one class at once using [] instead of {}.
Implementation "org.tinyjee.maven.dim.extensions.InlineCssParameterTransformer": ApiDoc | Source

Example:

%{include|inline-css=.red-box [ background-color:red; color: white; font-weight: bold; padding: 10pt; width: 50%; ] }
%{include|source-content=<div class\="red-box">Small Red Box</div>}
Small Red Box