[ic] Clarification regarding user tag

anandha prassanna interchange-users@interchange.redhat.com
Thu Nov 8 00:20:01 2001


Hi all & Mike ,
       I found a major difference between the behavior of
       user tag placed in catalog.cfg and the same placed in the
       it the dierective /usr/lib/interchange/usertag directory.

      The following is the usertag . This was a ditto from
      pdf supllied by the interchange for reference of user tag.

UserTag quick_table HasEndTag
UserTag quick_table Interpolate
UserTag quick_table Order border
UserTag quick_table Routine <<EOF
sub {
my ($border,$input) = @_;
&Log($input);
&Log($border);
$border = " BORDER=$border" if $border;
my $out = "<TABLE ALIGN=LEFT $border>";
my @rows = split /\n+/, $input;
my ($left, $right);
for(@rows) {
$out .= '<TR><TD ALIGN=RIGHT VALIGN=TOP>';
($left, $right) = split /\s*:\s*/, $_, 2;
$out .= '<B>' unless $left =~ /</;
$out .= $left;
$out .= '</B>' unless $left =~ /</;
$out .= '</TD><TD VALIGN=TOP>';
$out .= $right;
$out .= '</TD></TR>';
$out .= "\n";
}
$out .= '</TABLE>';
}
EOF

Now there has been a specification when the user tag has EndTag  the text
enclosed
with in the tag will the last input i.e.,
     my ($border,$input) = @_;

Now if i invoke this usertag with a .html page like this
when the user tag placed in catalog.cfg

[set name="Name"]Prassy[/set]
[set name="Country"]US[/set]
[quick-table border=2]
Name : [scratch Name]
City : [scratch Country]
[/quick_table]

This produce the output as desired that is
the
$border takes the value of 2
$input takes the value
Name : [scratch Name]
City : [scratch Country]

On the contrast if i place the usertag in the directory of interchange
/usr/lib/interchange/usertag

the ouput is not as desired.
Since
$border takes the value of 2
$input takes the valus of 2

To overcome this i just printed the @_ variable and
noticed that the text enclosed between the tags
came as the third parameter.

Hence i changed the
my ($border,$input) = @_;
to
my ($border,$in,$input) = @_;

Now this worked and produced
the desired tabular ouput containing

name         Prassy
country      Us


Note: When experimenting with the other one
i removed the usertag from the catalog.cfg
and restarted interchange.

Any body who can solve this is
greatly welcomed .

with regards,
Prassy.....