Revision 181
- Date:
- 2012/01/26 18:18:16
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/core/lib/Contenido/Parser/RSS.pm
50 50 my $content_global_type = delete $opts{content_type} || 1; 51 51 my $debug = $DEBUG; 52 52 my $gui = delete $opts{gui}; 53 my $preserve_tags = delete $opts{preserve_tags} || 0; 53 54 my $description_as_fulltext = delete $opts{description_as_fulltext}; 54 55 warn "Parser Rools: [".$opts{parser_rss}."]\n" if $debug && $opts{parser_rss}; 55 56 … … 58 59 warn "RSS Rools: ".Dumper ($rss_rools) if $debug && $rss_rools; 59 60 60 61 my @items; 61 my $feed = $self->__parse_content(\$content); 62 my $feed = $self->__parse_content(\$content, preserve_tags => $preserve_tags); 62 63 63 64 if ( ref $feed eq 'ARRAY' ) { 64 65 foreach my $item ( @$feed ) { … … 461 462 462 463 463 464 sub __parse_content { 464 my ($self, $contref) = @_; 465 my ($self, $contref, %opts) = @_; 465 466 466 467 my $feed_type = $self->__feed_type($contref); 467 468 # warn "FEED Type = [$feed_type]\n"; … … 474 475 #$$contref =~ s/<p>/\n\n/sgi; 475 476 #$$contref =~ s/<p\s(.*?)>/\n\n/sgi; 476 477 $$contref =~ s/<\/?strong\s(.*?)>//sgi; 477 $$contref =~ s/<\/?s>//sgi; 478 $$contref =~ s/<\/?i>//sgi; 479 $$contref =~ s/<\/?b>//sgi; 480 $$contref =~ s/<\/?strong>//sgi; 478 if ( $opts{preserve_tags} ) { 479 $$contref =~ s/<(\/?[sib])>/\[$1\]/sgi; 480 $$contref =~ s/<(\/?strong)>/\[$1\]/sgi; 481 $$contref =~ s/<(\/?em)>/\[$1\]/sgi; 482 } else { 483 $$contref =~ s/<(\/?[sib])>//sgi; 484 $$contref =~ s/<(\/?strong)>//sgi; 485 $$contref =~ s/<(\/?em)>//sgi; 486 } 481 487 #$$contref =~ s/<\/p>//sgi; 482 488 #$$contref =~ s/<\/p\s(.*?)>//sgi; 483 489 my @items; … … 1054 1060 my ($self, $text) = @_; 1055 1061 return unless $text; 1056 1062 1057 $text =~ s/^[\n\r\ \t]+//; 1058 $text =~ s/[\n\r\ \t]+$//; 1063 for ( $text ) { 1064 s/^[\n\r\ \t]+//; 1065 s/[\n\r\ \t]+$//; 1066 s/\[(\/?strong)\]/<$1>/sgi; 1067 s/\[(\/?em)\]/<$1>/sgi; 1068 s/\[(\/?[sib])\]/<$1>/sgi; 1069 } 1059 1070 $self->__cdata (\$text); 1060 1071 $self->__extchar (\$text); 1061 1072 # $text = HTML::Entities::decode_entities($text);