org.tinyjee.maven.dim.extensions
Class InlineScriptParameterTransformer
java.lang.Object
org.tinyjee.maven.dim.extensions.AbstractParameterTransformer
org.tinyjee.maven.dim.extensions.InlineScriptParameterTransformer
- All Implemented Interfaces:
- RequestParameterTransformer
public class InlineScriptParameterTransformer
- extends AbstractParameterTransformer
This extension adds an inline Script definition to the current page.
Use this extension to define simple scripts or execute pre-formatted blocks containing client side scripts (javascript).
- Author:
- Juergen_Kellerer, 2012-01-18
Field Summary |
static String |
PARAM_INLINE_SCRIPT
Enables this extension and sets the content to place inside the inlined "<script>" element. |
static String |
PARAM_SCRIPT_TYPE
Defines the language of the script to include, defaults to "javascript". |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PARAM_INLINE_SCRIPT
public static final String PARAM_INLINE_SCRIPT
- Enables this extension and sets the content to place inside the inlined "<script>" 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-script
" 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/script/to/inline
" to load the script from the classpath
instead of defining it with the macro call. Furthermore using a value of "." transforms the following verbatim text
section into a script block that is executed on the client side instead of being displayed.
Language constructs that require the braces "{}" are not supported from APT documents when adding the script content
to the macro call.
This is a limitation of the APT parser, however you can still use '.' and paste the script code into a verbatim text block
following the macro call.
Examples:
- "
%{include|inline-script=alert("hello world.")}
"
- "
%{include|inline-script=classpath:/path/to/my-script.js}
"
Sample Page with APT
%{include|inline-script=.}
---------
function sayHello() {
alert("hello world.");
}
sayHello();
---------
- See Also:
- Constant Field Values
PARAM_SCRIPT_TYPE
public static final String PARAM_SCRIPT_TYPE
- Defines the language of the script to include, defaults to "javascript".
- See Also:
- Constant Field Values
InlineScriptParameterTransformer
public InlineScriptParameterTransformer()
doTransformParameters
protected boolean doTransformParameters(Map<String,Object> requestParams)
- Specified by:
doTransformParameters
in class AbstractParameterTransformer