Changeset 140
- Timestamp:
- 09/14/07 17:23:48 (6 years ago)
- Location:
- lang/perl/Text-Nyarlax/trunk
- Files:
-
- 1 added
- 1 modified
-
lib/Text/Nyarlax/Parser/PRD.pm (modified) (3 diffs)
-
t/parser/spec/section.tb (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Text-Nyarlax/trunk/lib/Text/Nyarlax/Parser/PRD.pm
r108 r140 7 7 use List::MoreUtils qw( uniq ); 8 8 use base qw( Text::Nyarlax::Parser ); 9 10 our $VERSION = '0.1'; 9 11 10 12 __PACKAGE__->mk_classdata( 'engine' ); … … 84 86 <rulevar: local %variable = %Text::Nyarlax::Parser::PRD::variable > 85 87 <rulevar: local $variable_re= $Text::Nyarlax::Parser::PRD::variable_re > 86 parse : <skip: ''> Content(s) 88 <rulevar: local $h_level = 1 > 89 90 parse : <skip: ''> /\n*/ Content(s) 91 { 92 my $tree = $item{'Content(s)'}; 93 $tree = join_node( $tree, element => 'Section' ); 94 $return = $tree; 95 } 87 96 88 97 Content : Section | Paragraph 89 98 90 Section : Heading 91 { 99 Section : Heading Content(s?) 100 { 101 $h_level--; 92 102 my $elm = element( $item[0] ); 93 $elm->push_content( $item{'Heading'} ); 103 $elm->push_content( $item{'Heading'}, @{ $item{'Content(s?)'} } ); 104 $elm->join_content( element => 'Section' ); 94 105 $return = $elm; 95 106 } 96 107 97 108 Heading : <rulevar: local $text_re = qr{(?: (?! $exclude_re ) [^\n=] )+}x > 98 Heading : /[=]{1,}/ InlineNode(s) "$item[1]" Blank Identifier(?) Blank /\n/ 99 { 109 Heading : /[=]{$h_level}/ InlineNode(s) "$item[1]" Blank Identifier(?) Blank /\n*/ 110 { 111 $h_level++; 100 112 my $elm = element( $item[0] ); 101 113 … … 127 139 } 128 140 129 OneLine : InlineNode(s) /\n/141 OneLine : ...!/[=]/ InlineNode(s) /\n/ 130 142 { 131 143 $return = [ @{ $item{'InlineNode(s)'} }, "\n" ];
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)