1 %# BEGIN LICENSE BLOCK;
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
30 use Regexp::Common qw(delimited);
32 #my $quoted = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+];
33 my $justquoted = qr[$RE{delimited}{-delim=>qq{\'\"}}];
34 #my $quoted = $RE{quoted}{-esc};
35 my $word = qr [(?:\{|\}|\w|\.)+];
37 while ($Format =~ /($justquoted|$word)/igx) {
40 if ($col =~ /^$RE{quoted}{-esc}$/) {
41 substr($col,0,1) = "";
42 substr($col,-1,1) = "";
46 if ( $col =~ s/\/STYLE:(.*?)$//io ) {
47 $colref->{'style'} = $1;
49 if ( $col =~ s/\/CLASS:(.*?)$//io ) {
50 $colref->{'class'} = $1;
52 if ( $col =~ s/\/TITLE:(.*?)$//io ) {
53 $colref->{'title'} = $1;
55 if ( $col =~ /__(.*?)__/gio ) {
57 while ( $col =~ s/^(.*?)__(.*?)__//o ) {
58 push ( @subcols, $1 ) if ($1);
59 push ( @subcols, "__$2__" );
60 $colref->{'attribute'} = $2;
62 push ( @subcols, $col );
63 @{ $colref->{'output'} } = @subcols;
66 @{ $colref->{'output'} } = ( "__" . $col . "__" );
67 $colref->{'attribute'} = $col;
70 if ( !$colref->{'title'} && grep { /^__(.*?)__$/io }
71 @{ $colref->{'output'} } )
73 $colref->{'title'} = $1;
74 $colref->{'attribute'} = $1;
78 push @Columns, $colref;