Index: openacs-4/packages/acs-templating/tcl/date-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/date-procs.tcl,v diff -u -N -r1.63.2.17 -r1.63.2.18 --- openacs-4/packages/acs-templating/tcl/date-procs.tcl 16 Jan 2022 15:34:55 -0000 1.63.2.17 +++ openacs-4/packages/acs-templating/tcl/date-procs.tcl 30 Jan 2022 14:38:58 -0000 1.63.2.18 @@ -1636,7 +1636,7 @@ "-step": number of days jumped each time the date is incremented. Value must be an integer - Parameters supplied this way will superseded same named parameters + Parameters supplied this way will supersede same-named parameters supplied through the "-html" switch. This widget also adds the attribute "pattern" as fallback for @@ -1776,7 +1776,7 @@ "-step": integer value that equates to the number of seconds you want to increment by - Parameters supplied this way will superseded same named parameters + Parameters supplied this way will supersede same-named parameters supplied through the "-html" switch. This widget also adds the attribute "pattern" as fallback for 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.65.2.12 -r1.65.2.13 --- openacs-4/packages/acs-templating/tcl/parse-procs.tcl 1 Apr 2021 08:42:35 -0000 1.65.2.12 +++ openacs-4/packages/acs-templating/tcl/parse-procs.tcl 30 Jan 2022 14:38:58 -0000 1.65.2.13 @@ -34,8 +34,8 @@ [list &book "bookdata" base $base style feed]] - The [list &book "bookdata" ...] tells adp_include to pass the book array by reference to the adp include, where it is - referred to via @book.field@. + The [list &book "bookdata" ...] tells adp_include to pass the book array + by reference to the adp include, where it is referred to via @book.field@. @param uplevel how far up the stack should the adp_level be set to (default is the calling procedures level) @@ -70,17 +70,20 @@ strings from adp files. @param __adp_stub The root (without the file extension) of the - absolute path to the template and associated code. + absolute path to the template and associated code. @param __args One list containing any number of key-value pairs - passed to an included template from its container. - All data sources may be passed by reference. + passed to an included template from its container. + All data sources may be passed by reference. @see template::adp_include } { # declare any variables passed in to an include or master # TODO: call adp_set_vars instead. foreach {__key __value} $__args { - if {[string match "&*" $__key]} { # "&" triggers call by reference + # + # Keys starting with "&" trigger call by reference. + # + if {[string range $__key 0 0] eq "&"} { if {"&" ne $__key } { set __name [string range $__key 1 end] } else { @@ -95,13 +98,18 @@ upvar \#[adp_level] $__value:$__i $__name:$__i } } - } else { # not "&" => normal arg (no reference) + } else { + # + # Key does not start with "&" => normal arg (no reference). + # set $__key $__value } } - # set the stack frame at which the template is being parsed so that - # other procedures can reference variables cleanly + # + # Set the stack frame at which the template is being parsed so + # that other procedures can reference variables cleanly. + # lappend ::template::parse_level [info level] # execute the code to prepare the data sources for a template @@ -116,8 +124,10 @@ set mime_type [get_mime_type] set template_extension [get_mime_template_extension $mime_type] - # generate ADP output if a template exists (otherwise assume plain Tcl page) - + # + # Generate ADP output if a template exists (otherwise assume + # plain Tcl page) + # set templated_p 0 if { [ad_conn locale] ne "" && [file exists "$__adp_stub.[ad_conn locale].$template_extension"]} { @@ -133,35 +143,44 @@ && [::ds_enabled_p] && [::ds_page_fragment_cache_enabled_p] && [::ds_collection_enabled_p] } { - ns_cache get ds_page_bits [ad_conn request] template_list - lappend template_list $__adp_stub.$template_extension - ns_cache set ds_page_bits [ad_conn request] $template_list + ns_cache lappend ds_page_bits [ad_conn request] \ + $__adp_stub.$template_extension } if { $templated_p } { - - # ensure that template output procedure exists and is up-to-date + # + # Ensure that template output procedure exists and is + # up-to-date. + # template::adp_init $template_extension $__adp_stub - - # get result of template output procedure into __adp_output, and properties into __adp_properties + # + # Get result of template output procedure into __adp_output, + # and properties into __adp_properties + # template::code::${template_extension}::$__adp_stub # JCD: Lets keep a copy of all the page fragments! WooHoo. if { [namespace which ::ds_page_fragment_cache_enabled_p] ne "" && [::ds_enabled_p] && [::ds_page_fragment_cache_enabled_p] && [::ds_collection_enabled_p] } { - ns_cache set ds_page_bits "[ad_conn request]:$__adp_stub.$template_extension" $__adp_output + ns_cache set ds_page_bits \ + "[ad_conn request]:$__adp_stub.$template_extension" $__adp_output } # call the master template if one has been defined if { [info exists __adp_master] } { # pass properties on to master template set __adp_output [template::adp_parse $__adp_master \ - [concat [list __adp_slave $__adp_output] [array get __adp_properties]]] + [concat \ + [list __adp_slave $__adp_output] \ + [array get __adp_properties]]] } } else { - # no template; found_script_p tells us if adp_prepare at least found a script. + # + # No template; found_script_p tells us if adp_prepare at + # least found a script. + # if { !$found_script_p } { # No template. Perhaps there is an HTML file. if { [file exists $__adp_stub.html] } { @@ -325,8 +344,9 @@ # propagate aborting if {[info exists ::request_aborted]} { - ns_log warning "propagating abortion from $__adp_remember_stub.tcl\ - (status [lindex $::request_aborted 0]): '[lindex $::request_aborted 1]')" + ns_log warning "propagating abortion from $__adp_remember_stub.tcl" \ + "(status [lindex $::request_aborted 0]:"\ + "'[lindex $::request_aborted 1]'" unset ::request_aborted ad_script_abort #adp_abort @@ -511,9 +531,10 @@ regsub -all -- {([^0-9])%>} $chunk {\1} chunk # warn about the first ambiguity in the source if {[regexp {[0-9]+%>} $chunk match]} { - ns_log warning "ambiguous '$match'; write Tcl escapes with a space like\ - <% set x 50 %> and HTML tags with proper quoting, like
\ - when compiling ADP source: [list template::adp_compile -file $file -string $string]" + ns_log warning "ambiguous '$match'; write Tcl escapes with a space like" \ + {<% set x 50 %> and HTML tags with proper quoting, like
} \ + "when compiling ADP source: " \ + [list template::adp_compile -file $file -string $string] } # recursively parse the template @@ -537,19 +558,25 @@ {\1[template::expand_percentage_signs [lang::message::lookup $__ad_conn_locale {\2} {TRANSLATION MISSING} {} -1]]} \ code]} {} - # We do each substitution set in two pieces, separately for normal - # variables and for variables with ";noquote" attached to them. - # Specifically, @x@ gets translated to [ns_quotehtml ${x}], whereas - # @x;noquote@ gets translated to ${x}. The same goes for array - # variable references. + # + # We do each substitution set in several pieces, separately for + # normal variables and for variables having ";noquote", ";no18n", + # and ";literal" attached to them. Specifically, @x@ gets + # translated to [ns_quotehtml ${x}], whereas @x;noquote@ gets + # translated to ${x}. The same goes for array variable + # references. + # + # The approach with several regexp operations can be optimized, + # but since this is happening only at ADP compile time, this does + # not seem critical. # substitute array variable references while {[regsub -all -- [template::adp_array_variable_regexp_noquote] $code {\1[lang::util::localize $\2(\3)]} code]} {} while {[regsub -all -- [template::adp_array_variable_regexp_noi18n] $code {\1[ns_quotehtml $\2(\3)]} code]} {} while {[regsub -all -- [template::adp_array_variable_regexp_literal] $code {\1$\2(\3)} code]} {} # # Some aolservers have broken implementations of ns_quotehtml - # (returning for the empty string input a one byte output). + # (returning for the empty string input a one byte output). # while {[regsub -all -- [template::adp_array_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize $\2(\3)]]} code]} {} @@ -563,8 +590,7 @@ while {[regsub -all -- [template::adp_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize ${\2}]]} code]} {} } - # unescape protected # references - # unescape protected @ references + # unescape protected "#" and "@" references set code [string map { \\@ @ \\# #} $code] return $code @@ -861,4 +887,3 @@ # tcl-indent-level: 4 # indent-tabs-mode: nil # End: - Index: openacs-4/packages/acs-templating/tcl/test/captcha-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/test/Attic/captcha-procs.tcl,v diff -u -N -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/acs-templating/tcl/test/captcha-procs.tcl 28 Jan 2022 09:28:29 -0000 1.1.2.5 +++ openacs-4/packages/acs-templating/tcl/test/captcha-procs.tcl 30 Jan 2022 14:38:58 -0000 1.1.2.6 @@ -23,7 +23,7 @@ } set message "" set value [ns_queryget value] - # Simulate a 2 level depth for the api + # Simulate a 2-level depth for the API proc test args { return [template::data::validate::captcha value message] }