/[suikacvs]/markup/html/whatpm/Whatpm/mkhtmlparser.pl
Suika

Diff of /markup/html/whatpm/Whatpm/mkhtmlparser.pl

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

revision 1.6 by wakaba, Mon Mar 10 10:55:57 2008 UTC revision 1.7 by wakaba, Mon Mar 17 13:23:39 2008 UTC
# Line 17  while (<>) { Line 17  while (<>) {
17    s{!!!parse-error\s*\(}{    s{!!!parse-error\s*\(}{
18      q{$self->{parse_error}->(level => $self->{must_level}, }      q{$self->{parse_error}->(level => $self->{must_level}, }
19    }ge;    }ge;
20      s{!!!insert-element-t\s*\(([^(),]+),([^(),]+),([^(),]+)\)\s*;}{qq{
21        {
22          my \$el;
23          !!!create-element (\$el, $1, $2, $3);
24          \$insert->(\$el);
25          push \@{\$self->{open_elements}}, [\$el, $1];
26        }
27      }}ge;
28      s{!!!insert-element-t\s*\(([^(),]+),\s*,([^(),]+)\)\s*;}{qq{
29        {
30          my \$el;
31          !!!create-element (\$el, $1,, $2);
32          \$insert->(\$el);
33          push \@{\$self->{open_elements}}, [\$el, $1];
34        }
35      }}ge;
36    s{!!!insert-element-t\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{    s{!!!insert-element-t\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{
37      {      {
38        my \$el;        my \$el;
# Line 33  while (<>) { Line 49  while (<>) {
49        push \@{\$self->{open_elements}}, [\$el, $1];        push \@{\$self->{open_elements}}, [\$el, $1];
50      }      }
51    }}ge;    }}ge;
52      s{!!!insert-element\s*\(([^(),]+),\s*,([^(),]+)\)\s*;}{qq{
53        {
54          my \$el;
55          !!!create-element (\$el, $1,, $2);
56          \$self->{open_elements}->[-1]->[0]->append_child (\$el);
57          push \@{\$self->{open_elements}}, [\$el, $1];
58        }
59      }}ge;
60      s{!!!insert-element\s*\(([^(),]+),([^(),]+),([^(),]+)\)\s*;}{qq{
61        {
62          my \$el;
63          !!!create-element (\$el, $1, $2, $3);
64          \$self->{open_elements}->[-1]->[0]->append_child (\$el);
65          push \@{\$self->{open_elements}}, [\$el, $1];
66        }
67      }}ge;
68    s{!!!insert-element\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{    s{!!!insert-element\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{
69      {      {
70        my \$el;        my \$el;
# Line 49  while (<>) { Line 81  while (<>) {
81        push \@{\$self->{open_elements}}, [\$el, $1];        push \@{\$self->{open_elements}}, [\$el, $1];
82      }      }
83    }}ge;    }}ge;
84    s{!!!create-element\s*\(([^(),]+),([^(),]+)(?:,([^(),]+))?\)\s*;}{    s{!!!create-element\s*\(([^(),]+),([^(),]+)(?:,([^(),]*)(?>,([^(),]+))?)?\)\s*;}{
85        my $l_var = $1;
86      my $r = qq{      my $r = qq{
87        $1 = \$self->{document}->create_element_ns        $l_var = \$self->{document}->create_element_ns
88          (q<http://www.w3.org/1999/xhtml>, [undef, $2]);          (q<http://www.w3.org/1999/xhtml>, [undef, $2]);
89      };      };
90      if (defined $3) {      if (defined $3 and length $3) {
91        $r .= qq{        $r .= qq{
92          for my \$attr_name (keys %{$3}) {          for my \$attr_name (keys %{$3}) {
93            $1->set_attribute_ns (undef, [undef, \$attr_name],            $l_var->set_attribute_ns (undef, [undef, \$attr_name],
94                                  $3 ->{\$attr_name}->{value});                                  $3 ->{\$attr_name}->{value});
95          }          }
96        };        };
97      }      }
98        if (defined $4) {
99          my $token_var = $4;
100          $token_var =~ s/^\s+//;
101          $token_var =~ s/\s+$//;
102          $r .= qq{
103            $l_var->set_user_data (manakai_source_line => $token_var\->{line})
104                if defined $token_var\->{line};
105            $l_var->set_user_data (manakai_source_column => $token_var\->{column})
106                if defined $token_var\->{column};
107          };
108          ## TODO: In future version, it should be allowed for an application
109          ## developer to choose whether these information should be kept
110          ## for tracking or not for performance by some means.
111        }
112      $r;      $r;
113    }ge; # MUST    }ge; # MUST
114    s{!!!next-token;}{q{$token = $self->_get_next_token;}}ge;    s{!!!next-token;}{q{$token = $self->_get_next_token;}}ge;

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24