Class TokenMacro

java.lang.Object
org.jenkinsci.plugins.tokenmacro.TokenMacro
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
AdminEmailMacro, BuildNumberMacro, BuildUrlMacro, BuildUserMacro, DataBoundTokenMacro

public abstract class TokenMacro extends Object implements ExtensionPoint
A macro that expands to text values in the context of a AbstractBuild.

Various plugins, such as email-ext and description-setter, has this concept of producing some textual value out of a build (to become the e-mail content/subject, to be come the build description, etc), and the user is allowed to configure how those strings look like.

In such situation, it is useful to have a notion of "macro tokens", one that look like like

${foobar}
, and expands to some string value when evaluated. This is exactly such an abstraction, and it is placed in its own plugin in the hope that it's reusable by other plugins.

In more general form, the macro would have the following syntax structure:

 ${MACRONAME [, ARG, ARG, ...]}
 ARG := NAME [ = 'value' ]
 

Views

Implementation should have

help.jelly
that renders a DT tag that shows the syntax of the macro, followed by a DD tag that shows the details. See existing use of this extension point for the general guide line of the syntax.

Plugins interested in using the list of tags can use the "/lib/token-macro" taglib like the following, which expands to the HTML that lists all the tags and their usages:

 <help xmlons="/lib/token-macro"/>
 
Author:
Kohsuke Kawaguchi