[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Creating a new tag



Hi,

I've been moving my web site to WML, and I'm writing a function to
convert csv to tables, like this:

<TABLE>
<CSVTABLE>
a,b,c
d,e,f
g,h,j
</CSVTABLE>
</TABLE>

which becomes:

<TABLE>
<TR><TD>a</TD><TD>b</TD><TD>c</TD></TR>
<TR><TD>d</TD><TD>e</TD><TD>f</TD></TR>
<TR><TD>g</TD><TD>h</TD><TD>j</TD></TR>
</TABLE>


The function I've written so far is:

<define-tag csvtable endtag=required>
<perl>
    <perl:assign>%body</perl:assign>
    $perl_var0 =~ s/^\n//ismg;
    $perl_var0 =~ s/^/\<TR\>\<TD\>/ismg;
    $perl_var0 =~ s/,/\<\/TD\>\<TD\>/ismg;
    $perl_var0 =~ s/$/\<\/TD\>\<\/TR\>/ismg;
    print $perl_var0;
</perl>
</define-tag>

Which is very similar to the way I used to do it in perl (I realise I
should probably get $perl_var0 some other way).

However, this results in:

<TABLE>
<TR><TD></TD></TR>
a,b,c
d,e,f
g,h,j
</TABLE>

It appears that ePerl is ignoring the /m switch as getting $perl_var0 by
itself works. Is something working differently to normal perl, or is
something else wrong?

BTW, where are all the <perl:...> tags documented? I found <perl:assign>
in the wml library, but I've no idea what all the others do.

Regards,

Malcolm Edwards
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com