This filter replaces all token surrounded by a beginning and ending
token. The default beginning and ending tokens both default to '@'. The
optional NAnt.Core.Filters.ReplaceTokens.BeginToken
and NAnt.Core.Filters.ReplaceTokens.EndToken
attributes
can be specified to change either token. By default string
comparisons are case sensitive but this can be changed by setting the
optional NAnt.Core.Filters.ReplaceTokens.IgnoreCase
attribute to true
.
Tokens are specified by using the NAnt.Core.Types.Token
element. It is
possible to specify from 1 to n tokens and replacement values. Values can
be any valid NAnt expression.
Filters are intended to be used as a element of a NAnt.Core.Filters.FilterChain
.
Parameters
Attribute | Type | Description | Required |
---|---|---|---|
begintoken | char |
Marks the beginning of a token. The default is "@".
|
False |
endtoken | char |
Marks the end of a token. The default is "@".
|
False |
ignorecase | bool |
Determines if case will be ignored.
The default is
false .
|
False |
if | bool |
If
true then the filter will be used; otherwise,
skipped. The default is true .
|
False |
unless | bool |
Opposite of
NAnt.Core.Filters.Filter.IfDefined . If false
then the filter will be executed; otherwise, skipped. The default
is false .
|
False |
Nested elements
<token>
Tokens and replacement values.
Parameters
Attribute | Type | Description | Required |
---|---|---|---|
key | string |
Token to be replaced.
|
True |
value | string |
New value of token.
|
True |
if | bool |
Indicates if the token should be used to replace values.
If
true then the token will be used;
otherwise, not. The default is true .
|
False |
unless | bool |
Indicates if the token should not be used to replace values.
If
false then the token will be used;
otherwise, not. The default is false .
|
False |
<token>
Examples
Replace all occurrences of the string @DATE@ with the value of property "TODAY".
<replacetokens>
<token key="DATE" value="${TODAY}" />
</replacetokens>
Replace all occurrences of the string <DATE> with the value of property "TODAY".
<replacetokens begintoken="<" endtoken=">">
<token key="DATE" value="${TODAY}" />
</replacetokens>
Requirements
- Assembly
- NAnt
.Core .dll - Namespace
-
NAnt
.Core .Filters