/[papo]/papo/neb/neb/LayoutParser.pm
ViewVC logotype

Diff of /papo/neb/neb/LayoutParser.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by fheinz, Mon Apr 14 19:38:27 2003 UTC revision 1.2 by jlenton, Mon Apr 14 22:31:39 2003 UTC
# Line 22  my %classes = ( 'lam:hbox' => 'HBox', Line 22  my %classes = ( 'lam:hbox' => 'HBox',
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  }  }
# Line 38  sub Start Line 39  sub Start
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
# Line 46  sub Start Line 47  sub Start
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    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26