Menu

#8 #set has some bugs

open
nobody
None
5
2005-04-21
2005-04-21
No

code as below:
...
#elseif( $!dom.GetConfigValue("pattern") != "" )
#set( $pattern = $!dom.GetConfigValue("pattern") )
// for debug $pattern
#set( $contentChecker = "new
StringMetaType.RegexContentChecker(@\"$pattern\")" )
...
static readonly ContentChecker g_ContentChecker =
$contentChecker;
...

the function GetConfigValue is retrive data from
Hashtable, if key not exist then return String.Empty

the key pattern has a regex pattern string (19|20)\d\d\-(0
[1-9]|10|11|12)\-([012][1-9]|10|20|30|31)

NVelocity output as this
...StringMetaType.RegexContentChecker(@\"(19|20)
\d\d\-(0[1-9]|10|11|12)\-([012][1-9]|10|20|30|31)\");

if I change template as this:
#set( $contentChecker = "new
StringMetaType.RegexContentChecker(@'$pattern')" )
that will be work, but it is not I needed;

if I change template as this:
#set( $contentChecker = 'new
StringMetaType.RegexContentChecker(@"$pattern")' )

output is ...StringMetaType.RegexContentChecker
(@"$pattern");
the $pattern was not processed! but I the previous
$pattern is ok!

if I change template as this:
#set( $contentChecker = "new
StringMetaType.RegexContentChecker
(@"+"$pattern"+")" )
this line will be skipped without any exception, the
$contentChecker remain previous value!

Discussion


Log in to post a comment.