Changeset 431 for wiki-toolkit/trunk/lib/Wiki/Toolkit/Formatter/Default.pm
- Timestamp:
- 05/11/08 17:04:41 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
wiki-toolkit/trunk/lib/Wiki/Toolkit/Formatter/Default.pm
r244 r431 29 29 my $formatter = Wiki::Toolkit::Formatter::Default->new( %config ); 30 30 my $wiki = Wiki::Toolkit->new( store => $store, 31 formatter => $formatter );31 formatter => $formatter ); 32 32 33 33 =head1 METHODS … … 42 42 allowed_tags => [qw(b i)], # defaults to none 43 43 macros => {}, 44 node_prefix => 'wiki.cgi?node=' );44 node_prefix => 'wiki.cgi?node=' ); 45 45 46 46 Parameters will default to the values shown above (apart from … … 58 58 59 59 macros => { qr/(^|\b)\@SEARCHBOX(\b|$)/ => 60 qq(<form action="wiki.cgi" method="get">60 qq(<form action="wiki.cgi" method="get"> 61 61 <input type="hidden" name="action" value="search"> 62 62 <input type="text" size="20" name="terms"> … … 78 78 # Store the parameters or their defaults. 79 79 my %defs = ( extended_links => 0, 80 implicit_links => 1,81 allowed_tags => [],82 macros => {},83 node_prefix => 'wiki.cgi?node=',84 );80 implicit_links => 1, 81 allowed_tags => [], 82 macros => {}, 83 node_prefix => 'wiki.cgi?node=', 84 ); 85 85 86 86 my %collated = (%defs, %args); … … 111 111 if (scalar keys %allowed) { 112 112 # If we are allowing some HTML, parse and get rid of the nasties. 113 my $parser = HTML::PullParser->new(doc => $raw,114 start => '"TAG", tag, text',115 end => '"TAG", tag, text',116 text => '"TEXT", tag, text');117 while (my $token = $parser->get_token) {113 my $parser = HTML::PullParser->new(doc => $raw, 114 start => '"TAG", tag, text', 115 end => '"TAG", tag, text', 116 text => '"TEXT", tag, text'); 117 while (my $token = $parser->get_token) { 118 118 my ($flag, $tag, $text) = @$token; 119 if ($flag eq "TAG" and !defined $allowed{lc($tag)}) {120 $safe .= CGI::escapeHTML($text);121 } else {119 if ($flag eq "TAG" and !defined $allowed{lc($tag)}) { 120 $safe .= CGI::escapeHTML($text); 121 } else { 122 122 $safe .= $text; 123 123 } … … 135 135 136 136 return wikiformat($safe, {}, 137 { extended => $self->{_extended_links},138 prefix => $self->{_node_prefix},139 implicit_links => $self->{_implicit_links} } );137 { extended => $self->{_extended_links}, 138 prefix => $self->{_node_prefix}, 139 implicit_links => $self->{_implicit_links} } ); 140 140 } 141 141
