[ic] delimiter for tag parameters

Kevin Walsh kevin at cursor.biz
Thu Oct 27 03:22:06 EDT 2005

Ron Phipps [rphipps at reliant-solutions.com] wrote:
> Sorry to have so much issue with understanding this.  I'm still confused
> how the two differ. 
> We've determined that the following will result in incorrect syntax when
> the title contains quotes: 
> [mytag title="[item-field title]"]
> Why does the following not result in incorrect syntax:
> [tmpn title][item-field title][/tmpn]
> [mytag title="[scratch title]"]
> Does Interchange handle [item-field title] and [scratch title]
> differently? 
> Perhaps [item-field title] is simply replaced with its value and
> [scratch title] actually passes it's value differently?
Yes - that's right.  The [item-field title] is just a marker
that's replaced by the looping tag with a regex.  [scratch title]
is a "proper" tag that's interpolated.  The replacement could lead
to syntax errors in the subsequent interpolation run, as you fount.

Using the value 'Kevin says "hello"', I'll try to show you what
each of the two examples does:

Example #1: Using [item-field] as a parameter:

    [mytag title="[item-field title]"]

The above gets parsed to this, during the marker replacement run:

    [mytag title="Kevin says "hello""]

The interpolator will find a syntax error in there.

Example #2: Using the [tmpn] workaround:

    [tmpn title][item-field title][/tmpn]
    [mytag title="[scratch title]"]

The above gets parsed to this, during the marker replacement run:

    [tmpn title]Kevin says "hello"[/tmpn]
    [mytag title="[scratch title]"]

The first line now gets interpolated ok and sets up the "title"
temporary scratch.  We use [tmpn] because no Interpolation of the
tag body is required.

On the second line, the interpolator sets the title argument to
(literally) [scratch title].  The interpolator spots that the
argument contains a '[' character and runs a sub-interpolator on
the argument value.  The value passed into the [mytag] UserTag is
now the same as the value set in the scratchpad variable and
everyone's happy.

   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/

More information about the interchange-users mailing list