NAnt
![]() ![]() ![]() |
v0.92 |
Replaces tokens in the original input with user-supplied values.
This filter replaces all token surrounded by a beginning and ending token. The default beginning and ending tokens both default to '@'. The optional begintoken
and 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 ignorecase
attribute to true.
Tokens are specified by using the 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 <filterchain>.
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 if . If false then the filter will be executed; otherwise, skipped. The default is false. |
False |
ReplaceTokens filter token.
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 |
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>