Index: openacs-4/packages/acs-templating/tcl/tag-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/tag-procs.tcl,v diff -u -r1.20 -r1.20.2.1 --- openacs-4/packages/acs-templating/tcl/tag-procs.tcl 12 Jan 2015 09:41:40 -0000 1.20 +++ openacs-4/packages/acs-templating/tcl/tag-procs.tcl 1 Oct 2015 18:44:01 -0000 1.20.2.1 @@ -96,7 +96,7 @@ substitute variable references @return variable name } { - if { [regsub {^"@([a-zA-Z0-9_]+)\.([a-zA-Z0-9_.]+)@"$} $arg {\1(\2)} arg1] } { + if { [regsub {^"@([a-zA-Z0-9_]+)\.([a-zA-Z0-9_.-]+)@"$} $arg {\1(\2)} arg1] } { } elseif { [regsub {^"@([a-zA-Z0-9_:]+)@"$} $arg {\1} arg1] } { } else { set arg1 "" @@ -168,8 +168,8 @@ } in { - set expr "^([join [lrange $args $i end] "|"])\$" - append condition "\[regexp \"$expr\" $arg1\] " + append condition "$arg1 in { [lrange $args 2 end] } " + ns_log notice "==== in '$condition'" set next [llength $args] } @@ -189,20 +189,24 @@ if {$arg eq ""} { error "IF tag nil test uses string not variable for $arg1" } - #append condition "\[template::util::is_nil $arg\]" append condition "(!\[info exists $arg\] || \${$arg} eq {})" } set next $i } defined { # substitute variable references - if { ! ( [regsub {^"@([a-zA-Z0-9_]+)\.([a-zA-Z0-9_.]+)@"$} $arg1 {\1(\2)} arg1] - || [regsub {^"@([a-zA-Z0-9_:]+)@"$} $arg1 {\1} arg1] )} { - error "IF tag defined test uses string not variable for $arg1" + #if { ! ( [regsub {^"@([a-zA-Z0-9_]+)\.([a-zA-Z0-9_.]+)@"$} $arg1 {\1(\2)} arg1] + # || [regsub {^"@([a-zA-Z0-9_:]+)@"$} $arg1 {\1} arg1] )} { + # error "IF tag defined test uses string not variable for $arg1" + # } + + set arg [template_tag_subst_reference $arg1] + if {$arg eq ""} { + error "IF tag nil test uses string not variable for $arg1" } - - append condition "\[info exists $arg1\]" + ns_log notice "==== DEFINED '\[info exists $arg\]'" + append condition "\[info exists $arg\]" set next $i } @@ -217,7 +221,8 @@ } true { - append condition "\[template::util::is_true $arg1\]" + #append condition "\[template::util::is_true $arg1\]" + append condition "\[string is true -strict $arg1\]" set next $i } @@ -228,7 +233,8 @@ default { # treat as a shortcut for - append condition "\[template::util::is_true $arg1\]" + #append condition "\[template::util::is_true $arg1\]" + append condition "\[string is true -strict $x\]" set next [expr {$i - 1}] } }