Changeset 212
- Timestamp:
- 04/06/07 20:38:29 (2 years ago)
- Files:
-
- trunk/src/core/Spork/lib/Spork/Parser.pm (modified) (5 diffs)
- trunk/src/plugins/ingy/Document-Parser/lib/Document/Parser.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/core/Spork/lib/Spork/Parser.pm
r211 r212 1 1 package Spork::Parser; 2 2 use base 'Document::Parser'; 3 use XXX;4 3 5 4 my $ALPHANUM = '\p{Letter}\p{Number}\pM'; … … 85 84 sub handle_indent { 86 85 my $self = shift; 87 $self->subparse( indent =>parse_blocks => @_, sub {86 $self->subparse(parse_blocks => @_, sub { 88 87 s/^> *//mg; 89 88 s/\n+\z/\n/; … … 93 92 sub handle_center { 94 93 my $self = shift; 95 $self->subparse( center =>parse_blocks => @_);94 $self->subparse(parse_blocks => @_); 96 95 } 97 96 98 97 sub handle_h2 { 99 98 my $self = shift; 100 $self->subparse( h2 =>parse_phrases => @_);99 $self->subparse(parse_phrases => @_); 101 100 } 102 101 103 102 sub handle_p { 104 103 my $self = shift; 105 $self->subparse(p => parse_phrases => @_, sub { s/\n+\z// });104 $self->subparse(parse_phrases => @_, sub { s/\n+\z// }); 106 105 } 107 106 108 107 sub handle_pre { 109 108 my $self = shift; 110 $self->subparse(p re => parse_phrases => @_, sub {109 $self->subparse(parse_phrases => @_, sub { 111 110 while (not /^\S/m) { 112 111 s/^ //gm; … … 117 116 sub handle_ul { 118 117 my $self = shift; 119 $self->subparse( ul =>parse_blocks => @_, sub {118 $self->subparse(parse_blocks => @_, sub { 120 119 s/^\* *//mg; 121 120 s/\n+\z/\n/; … … 125 124 sub handle_li { 126 125 my $self = shift; 127 $self->subparse( li =>parse_phrases => @_);126 $self->subparse(parse_phrases => @_); 128 127 } 129 128 130 129 sub handle_hilite { 131 130 my $self = shift; 132 $self->subparse( hilite =>parse_phrases => @_);131 $self->subparse(parse_phrases => @_); 133 132 } 134 133 135 134 sub handle_b { 136 135 my $self = shift; 137 $self->subparse( b =>parse_phrases => @_);136 $self->subparse(parse_phrases => @_); 138 137 } 139 138 140 139 sub handle_tt { 141 140 my $self = shift; 142 $self->subparse( tt =>parse_phrases => @_);141 $self->subparse(parse_phrases => @_); 143 142 } 144 143 145 144 sub handle_i { 146 145 my $self = shift; 147 $self->subparse( i =>parse_phrases => @_);146 $self->subparse(parse_phrases => @_); 148 147 } 149 148 trunk/src/plugins/ingy/Document-Parser/lib/Document/Parser.pm
r211 r212 109 109 my ($self, $type, $match) = @_; 110 110 my $func = "handle_$type"; 111 $self->$func($match); 112 } 111 $self->$func($match, $type); 112 } 113 114 # sub handle_p { 115 # my $self = shift; 116 # $self->subparse(p => parse_phrases => @_, sub { s/\n+\z// }); 117 # } 118 113 119 114 120 sub subparse { 115 my ($self, $ type, $func, $match, $filter) = @_;121 my ($self, $func, $match, $type, $filter) = @_; 116 122 $self->{ast}->begin_node($type); 117 123 my $parser = $self->new(
