Changeset 1382
- Timestamp:
- 08/19/06 12:30:33
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Filter/EntryFullText.pm
r1377 r1382 233 233 } 234 234 235 sub xml_escape { 236 for my $x (@_) { 237 $x = Plagger::Util::encode_xml($x); 238 } 239 } 240 235 241 sub extract { 236 242 my($self, $args) = @_; … … 258 264 my @children = $tree->findnodes($self->{extract_xpath}->{$capture}); 259 265 if (@children) { 260 $data->{$capture} = $children[0]->as_HTML; 266 no warnings 'redefine'; 267 local *HTML::Element::_xml_escape = \&xml_escape; 268 $data->{$capture} = $children[0]->as_XML; 261 269 } else { 262 270 Plagger->context->log(error => "Can't find node matching $self->{extract_xpath}->{$capture}"); trunk/plagger/lib/Plagger/Util.pm
r997 r1382 23 23 } 24 24 } 25 26 27 25 28 26 sub strip_html { … … 148 146 } 149 147 148 my %entities = ( 149 '&' => '&', 150 '<' => '<', 151 '>' => '>', 152 "'" => '"', 153 ); 154 155 my $entities_re = join '|', keys %entities; 156 157 sub encode_xml { 158 my $stuff = shift; 159 $stuff =~ s/($entities_re)/$entities{$1}/g; 160 $stuff; 161 } 162 150 163 1;
