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 -N -r1.18.2.2 -r1.18.2.3 --- openacs-4/packages/acs-templating/tcl/tag-procs.tcl 7 Jul 2014 19:13:08 -0000 1.18.2.2 +++ openacs-4/packages/acs-templating/tcl/tag-procs.tcl 7 Sep 2014 18:40:30 -0000 1.18.2.3 @@ -92,6 +92,19 @@ return $tokens } +ad_proc -private template_tag_subst_reference {arg} { + substitute variable references + @return variable name +} { + 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 "" + } + return $arg1 +} + + ad_proc -public template_tag_if_interp_expr {} { Interpret an expression as part of the simplified IF syntax } { @@ -103,9 +116,20 @@ set op [lindex $args 1] if { $op eq "not" } { - append condition "! (" - set close_paren ")" + # + # Optimize common case "@arg@ no nil" + # set op [lindex $args 2] + set arg1 \"[lindex $args 0]\" + if {$op eq "nil" && [string first @ $arg1] > -1} { + set arg1 [template_tag_subst_reference $arg1] + append condition "\[info exists $arg1\] && \${$arg1} ne {}" + set args [lrange $args 3 end] + return + } else { + append condition "! (" + set close_paren ")" + } set i 3 } else { set close_paren "" @@ -161,12 +185,12 @@ # We're assuming this is a static string, not a variable append condition "$arg1 eq {}" } else { - # substitute array variables - if {! ( [regsub {^"@([a-zA-Z0-9_]+)\.([a-zA-Z0-9_.]+)(;\w+)?@"$} $arg1 {\1(\2)} arg1] - || [regsub {^"@([a-zA-Z0-9_:]+)(;\w+)?@"$} $arg1 {\1} arg1] ) } { + set arg [template_tag_subst_reference $arg1] + if {$arg eq ""} { error "IF tag nil test uses string not variable for $arg1" } - append condition "\[template::util::is_nil $arg1\]" + #append condition "\[template::util::is_nil $arg\]" + append condition "!\[info exists $arg\] || \${$arg} eq {}" } set next $i } Index: openacs-4/www/blank-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.adp,v diff -u -N -r1.29.8.1 -r1.29.8.2 --- openacs-4/www/blank-master.adp 12 May 2014 11:17:18 -0000 1.29.8.1 +++ openacs-4/www/blank-master.adp 7 Sep 2014 18:40:29 -0000 1.29.8.2 @@ -1,14 +1,14 @@ -@doc.type;noquote@ - lang="@doc.lang;noquote@"> +@doc.type;literal@ + lang="@doc.lang;literal@"> - lang="@doc.title_lang;noquote@">@doc.title;noquote@ + lang="@doc.title_lang;literal@">@doc.title;noquote@ - http-equiv="@meta.http_equiv;noquote@" name="@meta.name;noquote@" scheme="@meta.scheme;noquote@" lang="@meta.lang;noquote@" content="@meta.content@"> + http-equiv="@meta.http_equiv;literal@" name="@meta.name;noquote@" scheme="@meta.scheme;noquote@" lang="@meta.lang;literal@" content="@meta.content@"> - lang="@link.lang;noquote@" title="@link.title;noquote@" type="@link.type;noquote@" media="@link.media@"> + lang="@link.lang;literal@" title="@link.title;noquote@" type="@link.type;literal@" media="@link.media;literal@"> - @@ -18,21 +18,21 @@ - - + -@head;noquote@ + +@head;literal@ - class="@body.class;noquote@" id="@body.id;noquote@"@event_handlers;noquote@> - @header;noquote@ + class="@body.class;literal@" id="@body.id;literal@"@event_handlers;literal@> + @header;literal@ - @footer;noquote@ - + @footer;literal@ +