|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IncludeMacroSignature
Defines the signature of the include macro.
Field Summary | |
---|---|
static String |
PARAM_CHARSET
Defines the charset to use when loading the source content. |
static String |
PARAM_CHARSET_AUTODETECT
Toggles whether charset detection is used when loading source content. |
static String |
PARAM_FILE
Sets the source path using java.io.File instead of evaluating it against URL
or File paths. |
static String |
PARAM_HIGHLIGHT
Deprecated. |
static String |
PARAM_HIGHLIGHT_LINES
Defines lines to highlight inside verbatim content using the same selection logic as used within the " snippet " parameter. |
static String |
PARAM_HIGHLIGHT_THEME
Sets the highlighting color theme to use. |
static String |
PARAM_HIGHLIGHT_TYPE
Sets the highlighter (brush) to use when highlighting verbatim content. |
static String |
PARAM_NO_CACHE
Forces the re-loading of source content when set to true . |
static String |
PARAM_PAD_LINE_NUMBERS
Pads all line numbers by the specified amount of zeros (if gutter is shown). |
static String |
PARAM_SET_FIRST_LINE
Sets the line number to use for the first line (if gutter is shown). |
static String |
PARAM_SHOW_GUTTER
Toggles whether the gutter including line numbers is shown for verbatim content. |
static String |
PARAM_SITE_DIRECTORY
Deprecated. |
static String |
PARAM_SNIPPET
Sets one or more comma separated expression to select the content snippets to include. |
static String |
PARAM_SNIPPET_END_OFFSET
Optional parameter that can be used to grow the end of snippet selections by the given amount of lines. |
static String |
PARAM_SNIPPET_GROW_EXCLUDES
Optional boolean parameter that toggles whether growing is applied to exclusions as well. |
static String |
PARAM_SNIPPET_GROW_OFFSET
Optional parameter that can be used to grow snippet selections by the given amount of lines. |
static String |
PARAM_SNIPPET_ID
Deprecated. |
static String |
PARAM_SNIPPET_START_OFFSET
Optional parameter that can be used to grow the start of snippet selections by the given amount of lines. |
static String |
PARAM_SOURCE
Sets the content to include using a source path, source URL or the fully qualified java class name. |
static String |
PARAM_SOURCE_CLASS
Sets a class to use as dynamic source for content, request parameters or both. |
static String |
PARAM_SOURCE_CONTENT
Sets the source content inline with the macro call. |
static String |
PARAM_SOURCE_CONTENT_TYPE
Sets the content type of the source. |
static String |
PARAM_SOURCE_IS_TEMPLATE
Toggles whether the source content is treated as a Velocity template. |
static String |
PARAM_VERBATIM
Toggles whether the content is verbatim (included as source) or non-verbatim (included as markup and interpreted). |
Field Detail |
---|
static final String PARAM_SOURCE
source=path/to/file
source=my.package.MyClass
source=/absolute/path/to/file
source=http://somehost/someservice#.xml
source=classpath:/bundled/template.vm
Relative source paths are resolved against multiple base locations including site, java (test)source and
resource directories. Non existing absolute paths starting with the project's base directory are stripped and retried
using the relative paths resolver.
initialize
" within the maven build enables the following additional syntax for referencing a
module file location:
[artifactId]:path/to/file
[groupId:artifactId]:path/to/file
[top]:path/to/file/in/project/root
Finally sources can also be loaded from the module's or the site building classpath using "classpath:/path/to/file
".
sources
and test-sources
folder with the parent
classloader being defined by the dependency list of the maven-site-plugin
.
When the goal "initialize
" is executed the classpath includes all dependencies that are defined inside
the pom.xml
.
static final String PARAM_SOURCE_CLASS
java.util.Map
(or derive from a Map implementation like java.util.HashMap
).
All entries of this map are treated as if they had been specified as request parameters,
on the macro call (therefore all parameters except 'source-class' can be set dynamically).
The source class may choose to use one of the 4 constructor signatures: Default
,
Constructor(java.io.File basePath)
, Constructor(java.util.Map requestProperties)
or Constructor(java.io.File basePath, java.util.Map requestProperties)
.
The default behaviour of a source class should be to provide properties for a velocity template that is specified by
either setting the "source" key to a bundled template or require the user to set the parameter when using the macro with
this class."source"
). To do so the map key "source-content"
must either return a String
or
Map<Integer, List<String>>
(firstLine=>lines) containing the content to include.
The classpath that is used to load the class is similar to the classpath used when loading sources.
(see "source"
parameter for more information)
Simple Example:
package my.package;
public class MySource extends HashMap<String, Object> {
public MySource(java.io.File basePath, java.util.Map requestProperties) {
putAll(requestProperties);
put("verbatim", false);
put("source-content", "<b>Hello World!</b>");
}
}
Macro Call:
%{include|source-class=my.package.MySource}
static final String PARAM_SOURCE_CONTENT
source-is-template
" is set to "true
" when this parameter is set with the
macro call (it is not implicitly set when the parameter was set by a source class).
Example: Including the main java doc comment of a class (using the JavaSourceLoader extension)
%{include|source-content=$comment|source-java=my.package.MyClass}
static final String PARAM_FILE
java.io.File
instead of evaluating it against URL
or File paths.
Under normal conditions it's easier to set the "source"
parameter instead.
However there may be occasions where it's necessary to force that the path is treated
as a file path.
static final String PARAM_SOURCE_IS_TEMPLATE
static final String PARAM_SOURCE_CONTENT_TYPE
static final String PARAM_CHARSET
initialize
was executed.
static final String PARAM_CHARSET_AUTODETECT
static final String PARAM_VERBATIM
@Deprecated static final String PARAM_SNIPPET_ID
// START SNIPPET: snippet-id
... code to include ...
// END SNIPPET: snippet-id
Note: From version 1.1 this parameter is deprecated, use snippet
instead.
Calls like "%{include|id=SnippetId|..}
" translate to %{include|snippet=#SnippetId|..}
static final String PARAM_SNIPPET
prefix:expression1, prefix:expression2
, .." to include
matching content and "!prefix:expression1, !prefix:expression2
, .." to exclude matching content.
Examples:snippet=#SnippetId
'snippet=!snippet-ids
'snippet=#SnippetId, !snippet-ids
'snippet=grep:Token,!grep:NotToken
'snippet=re:([0-9,.;\s]+)$
' (all lines ending with numeric expressions)snippet=xp:/html/head/title
'snippet=aj:..InnerClass, !aj:..toString()
'snippet=tb:"json-key"{, !tb:"inner-array"[
'snippet=lines:50-100
'SnippetSelector
.
static final String PARAM_SNIPPET_GROW_OFFSET
static final String PARAM_SNIPPET_START_OFFSET
static final String PARAM_SNIPPET_END_OFFSET
static final String PARAM_SNIPPET_GROW_EXCLUDES
static final String PARAM_SHOW_GUTTER
static final String PARAM_SET_FIRST_LINE
static final String PARAM_PAD_LINE_NUMBERS
@Deprecated static final String PARAM_HIGHLIGHT
highlight=1,5,10,20-25
As of version 1.1-beta this option is deprecated and was replaced by "highlight-lines
".
The example usage from above translates to "highlight-lines=lines:1,5,10,20-25
"
static final String PARAM_HIGHLIGHT_LINES
snippet
" parameter.
Selected lines are highlighted by the use of a background color.
Examples:highlight-lines=grep:org.tinyjee.dim+3
"highlight-lines=xp://license
"highlight-lines=lines:1,5,10,20-25
"
static final String PARAM_HIGHLIGHT_TYPE
html/[brushname]
" allows to highlight HTML with embedded scripts.
A common use case is "html/js
" which highlights any HTML-like code with embedded javascript (Note: files with
an extension of ".xhtml" or ".html" default to this highlighting type).
static final String PARAM_HIGHLIGHT_THEME
default
", "django
", "eclipse
",
"emacs
", "fadeToGrey
", "MDUltra
",
"midnight
", "RDark
".
(See:
http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/)
static final String PARAM_NO_CACHE
true
.
Content is cached for the lifetime of the build to avoid double
downloads of remote resources.
@Deprecated static final String PARAM_SITE_DIRECTORY
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |