22 |
'button' => 'Button', |
'button' => 'Button', |
23 |
'label' => 'Label'); |
'label' => 'Label'); |
24 |
# create a regexp to find out whether we handle a given tag |
# create a regexp to find out whether we handle a given tag |
25 |
my $handled_tags = join("|", map {s/(\W)/\\$1/g, $_} keys %classes); |
my $handled_tags = '^(' . join("|", map quotemeta, keys %classes) . ')$'; |
26 |
|
$handled_tags = qr/$handled_tags/; |
27 |
|
|
28 |
sub Init |
sub Init |
29 |
{ |
{ |
30 |
my $expat = shift; |
my $expat = shift; |
31 |
my $obj = neb::Tree::Container->new; |
my $obj = neb::Tree::Container->new($expat->{'lam_root_name'}); |
32 |
$expat->{"lam_parser_current"} = $obj; |
$expat->{"lam_parser_current"} = $obj; |
33 |
$expat->{"lam_parser_stack"} = [ $obj ]; |
$expat->{"lam_parser_stack"} = [ $obj ]; |
34 |
} |
} |
39 |
my $name = shift; |
my $name = shift; |
40 |
my $class = 'neb::Tree::'; |
my $class = 'neb::Tree::'; |
41 |
|
|
42 |
if ($name =~ m'^($handled_tags)$') |
if ($name =~ $handled_tags) |
43 |
{ |
{ |
44 |
$class .= exists $classes{$1} ? $classes{$1} : $1; |
$class .= exists $classes{$1} ? $classes{$1} : $1; |
45 |
} else |
} else |
47 |
$class .= 'Tag'; |
$class .= 'Tag'; |
48 |
} |
} |
49 |
|
|
50 |
my $obj = $class->new($name, @_); |
my $obj = $class->new($name, $expat->{'lam_parser_current'}->url, @_); |
51 |
|
|
52 |
$expat->{"lam_parser_current"}->add_content($obj); |
$expat->{"lam_parser_current"}->add_content($obj); |
53 |
|
|