Changeset 8483 for lang/perl/Text-MicroMason-SafeServerPages
- Timestamp:
- 03/29/08 04:23:29 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Text-MicroMason-SafeServerPages/trunk/lib/Text/MicroMason/SafeServerPages.pm
r8415 r8483 6 6 7 7 my %block_types = ( 8 '' => 'perl', # <% perl statements %>9 '=' => 'expr', # <%= perl expression (HTML escaped) %>8 '' => 'perl', # <% perl statements %> 9 '=' => 'expr', # <%= perl expression (HTML escaped) %> 10 10 'raw=' => 'expr', # <%= perl expression (raw) %> 11 '--' => 'doc', # <%-- this text will not appear in the output --%>12 '&' => 'file', # <%& filename argument %>11 '--' => 'doc', # <%-- this text will not appear in the output --%> 12 '&' => 'file', # <%& filename argument %> 13 13 ); 14 14 15 my $re_eol = "(?:\\r \\n|\\r|\\n|\\z)";16 my $re_tag = " perl|args|once|init|cleanup|doc|text|expr|file";15 my $re_eol = "(?:\\r?\\n|\\r|\\z)"; 16 my $re_tag = "args|cleanup|doc|expr|file|init|once|perl|text"; 17 17 18 18 sub lex_token { 19 # Blocks in <%word> ... < %word> tags.20 /\G \<\%($re_tag)\> (.*?) \<\/\%\1\> $re_eol? /xcogs ? ( $1 => $2 ) :19 # Blocks in <%word> ... </%word> tags. 20 /\G <% ($re_tag) \s*> (.*?) <\/% \1 \s*> $re_eol? /xcogs ? ( $1 => $2 ) : 21 21 22 22 # Blocks in <% ... %> tags. 23 /\G \<\% (\=|\&|raw=)? ( .*? ) \%\> /gcxs ? ( $block_types{$1 || ''} => ($1 eq '=') ? "encode_entities(do { $2 })": $2 ) :23 /\G <% ((?:(?:raw)?=|&)?) (.*?) %> /gcxs ? ( $block_types{$1} => ($1 eq '=') ? "encode_entities(do { $2 })" : $2 ) : 24 24 25 25 # Blocks in <%-- ... --%> tags. 26 /\G \<\% \-\- ( .*? ) \-\- \%\> /gcxs ? ( 'doc' => $1 ) :26 /\G <% -- (.*?) -- %> /gcxs ? ( 'doc' => $1 ) : 27 27 28 # Things that don't match the above 29 /\G ( (?: [^ \<]+ | \<(?!\%) )?) /gcxs ? ( 'text' => $1 ) :28 # Things that don't match the above. 29 /\G ( (?: [^<] | <(?!\/?%) )+ ) /gcxs ? ( 'text' => $1 ) : 30 30 31 # Lexer error 31 # Lexer error. 32 32 () 33 33 } … … 52 52 =head1 SYNOPSIS 53 53 54 use Text::MicroMason; 54 55 use Text::MicroMason::SafeServerPages; 55 56 … … 69 70 print $cr->( 70 71 title => "Foo<bar>", 71 body => "<div class='section'>aaaa</div>",72 body => qq{<div class="section">aaaa</div>}, 72 73 ); 73 74
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)