Index: openacs-4/packages/acs-templating/tcl/parse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/parse-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-templating/tcl/parse-procs.tcl 5 Nov 2002 17:03:41 -0000 1.10 +++ openacs-4/packages/acs-templating/tcl/parse-procs.tcl 12 Nov 2002 15:42:41 -0000 1.11 @@ -325,29 +325,32 @@ } { set remaining_message $message set formatted_message "" - while { [regexp {^(.*?)(%[a-zA-Z_\.]+%)(.*)$} $remaining_message match before_percent percent_match remaining_message] } { + while { [regexp [lang::message::embedded_vars_regexp] $remaining_message match before_percent percent_match remaining_message] } { append formatted_message $before_percent - # Convert syntax to TCL syntax: + if { [string equal $percent_match "%%"] } { + # A quoted percentage sing + set substitution "%" + } else { + # An embedded variable + + # Convert syntax to TCL syntax: + # It's either an array variable or a tcl variable + # array variables + regsub {^%([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)%$} $percent_match {$\1(\2)} substitution + # ordinary variables + regsub {^%([a-zA-Z0-9_:]+)%$} $substitution {$\1} substitution - # array variables - - regsub {%([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)%} $percent_match {$\1(\2)} substitution - - # ordinary variables - - regsub {%([a-zA-Z0-9_]+)%} $substitution {$\1} substitution - - # Create command to execute in caller's scope - - set command "subst -nocommands \"$substitution\"" + # Create command to execute in caller's scope + set command "subst -nocommands \"$substitution\"" - # and execute that + # and execute that + set substitution [uplevel $command] + } - set substitution [uplevel $command] - append formatted_message $substitution } + append formatted_message $remaining_message return $formatted_message