• Publicity: Public Only All

0-acs-templating-procs.tcl

Initialize namespaces, global macros and filters for ArsDigita Templating System

Location:
packages/acs-templating/tcl/0-acs-templating-procs.tcl
Author:
Karl Goldstein <karlg@arsdigita.com>
CVS Identification:
$Id: 0-acs-templating-procs.tcl,v 1.6 2024/09/11 06:15:48 gustafn Exp $

Procedures in this file

Detailed information

template::tag (public)

 template::tag name arglist body

Generic wrapper for registered tag handlers.

Parameters:
name (required)
arglist (required)
body (required)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-templating/tcl/tag-init.tcl packages/acs-templating/ tcl/tag-init.tcl template::tag template::tag packages/acs-templating/tcl/tag-init.tcl->template::tag template_tag template_tag (public, deprecated) template_tag->template::tag _ _ (public) template::tag->_

Testcases:
No testcase defined.

template_tag (public, deprecated)

 template_tag [ args... ]
Deprecated. Invoking this procedure generates a warning.

Generic wrapper for registered tag handlers. DEPRECATED: does not comply with OpenACS naming convention

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) template::tag template::tag (public) template_tag template_tag template_tag->ad_log_deprecated template_tag->template::tag

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
    Initialize namespaces, global macros and filters for ArsDigita Templating
    System

    @author Karl Goldstein (karlg@arsdigita.com)

    @cvs-id $Id: 0-acs-templating-procs.tcl,v 1.6 2024/09/11 06:15:48 gustafn Exp $
}

# Initialize namespaces used by template procs

# Copyright (C) 1999-2000 ArsDigita Corporation

# This is free software distributed under the terms of the GNU Public
# License.  Full text of the license is available from the GNU Project:
# http://www.fsf.org/copyleft/gpl.html

ad_proc -deprecated template_tag args {
    Generic wrapper for registered tag handlers.

    DEPRECATED: does not comply with OpenACS naming convention

    @see template::tag
} {
    return [template::tag {*}$args]
}

d_proc -public template::tag {
    name
    arglist
    body
} {
    Generic wrapper for registered tag handlers.
} {

  # LARS:
  # We only ns_adp_registerscript the tag if it hasn't already been registered
  # (if the proc doesn't exist).
  # This makes debugging templating tags so much easier, because you don't have
  # to restart the server each time.
  set exists_p [expr {[namespace which template_tag_$name] ne {}}]

  switch [llength $arglist] {

    1 {

      # empty tag
      eval "proc template_tag_$name { params } {

    template::adp_tag_init $name

    $body

        return \"\"
      }"

      if { !$exists_p } {
        ns_adp_registerscript $name template_tag_$name
      }
    }

    2 {

      # balanced tag so push on/pop off tag name and parameters on a stack
      eval "proc template_tag_$name { chunk params } {

    template::adp_tag_init $name

    lappend ::template::tag_stack \[list $name \$params\]

    $body

    template::util::lpop ::template::tag_stack

        return \"\"
      }"

      if { !$exists_p } {
        ns_adp_registerscript $name /$name template_tag_$name
      }
    }

    default { error [_ acs-templating.Tag_handler_invalid_number_of_args] }
  }
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: