Changeset 89

Show
Ignore:
Timestamp:
09/12/07 14:57:58 (6 years ago)
Author:
nyarla
Message:

lang/perl/Text-Nyarlax: I implemented parse of the Heading element on Text::Nyarlax::Parser::PRD.

Location:
lang/perl/Text-Nyarlax/trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Text-Nyarlax/trunk/lib/Text/Nyarlax/Parser/PRD.pm

    r88 r89  
    8383                            <rulevar: local %variable   = %Text::Nyarlax::Parser::PRD::variable     > 
    8484                            <rulevar: local $variable_re= $Text::Nyarlax::Parser::PRD::variable_re  > 
    85     parse               :   <skip: ''> Content 
    86  
    87     Content             :   Paragraph 
     85    parse               :   <skip: ''> Content(s) 
     86 
     87    Content             :   Section | Paragraph 
     88 
     89    Section             :   Heading 
     90                        { 
     91                            my $elm = element( $item[0] ); 
     92                            $elm->push_content( $item{'Heading'} ); 
     93                            $return = $elm; 
     94                        } 
     95 
     96    Heading             :   <rulevar: local $text_re = qr{(?: (?! $exclude_re ) [^\n=] )+}x > 
     97    Heading             :   /[=]{1,}/ InlineNode(s) "$item[1]" Blank Identifier(?) Blank /\n/ 
     98                        { 
     99                            my $elm = element( $item[0] ); 
     100 
     101                            my @text = @{ $item{'InlineNode(s)'} }; 
     102                            $text[0] =~ s{^[ \t]*}{}g       if ( ! ref $text[0] ); 
     103                            $text[$#text] =~ s{[ \t]*$}{}g  if ( ! ref $text[$#text] ); 
     104                            $elm->push_content( @text ); 
     105 
     106                            $elm->attr->{'id'} = $item{'Identifier(?)'}->[0] 
     107                                if ( $item{'Identifier(?)'}->[0] ); 
     108 
     109                            $return = $elm; 
     110                        } 
    88111 
    89112    # Paragraph 
     
    253276                        |  m{$text_re} 
    254277 
     278    Blank               :   /[ \t]*/ 
     279 
     280    Identifier          :   /[a-zA-Z]+/ 
     281 
    255282__GRAMMER__ 
    256283