1 package HTML::Zoom::Parser::BuiltIn;
3 sub _hacky_tag_parser {
4 my ($text, $handler) = @_;
9 ( / )? ( [^/!<>\s"'=]+ )
10 ( (?:"[^"]*"|'[^']*'|[^"'<>])+? )?
12 (!-- .*? -- | ![^\-] .*? )
18 my ($whole, $is_close, $tag_name, $attributes, $is_comment,
19 $in_place_close, $content)
20 = ($1, $2, $3, $4, $5, $6, $7, $8);
21 next if defined $is_comment;
22 $tag_name =~ tr/A-Z/a-z/;
24 $handler->({ type => 'CLOSE', name => $tag_name, raw => $whole });
26 $attributes = '' if $attributes =~ /^ +$/;
30 is_in_place_close => $in_place_close,
31 _hacky_attribute_parser($attributes),
32 raw_attrs => $attributes||'',
35 if ($in_place_close) {
37 type => 'CLOSE', name => $tag_name, raw => '',
38 is_in_place_close => 1
42 if (length $content) {
43 $handler->({ type => 'TEXT', raw => $content });
48 sub _hacky_attribute_parser {
50 my (%attrs, @attr_names);
53 ([^\s\=\"\']+)(\s*=\s*(?:(")(.*?)"|(')(.*?)'|([^'"\s=]+)['"]*))?
58 my $val = ( $3 ? $4 : ( $5 ? $6 : $7 ));
61 $attrs{$lckey} = _simple_unescape($val);
63 $attrs{$lckey} = $lckey;
65 push(@attr_names, $lckey);
67 (attrs => \%attrs, attr_names => \@attr_names);
70 sub _simple_unescape {