added a new function to WebGUI::HTML to parse html text and extract a list of elements based on a tag

spec. used to extract paragraphs for the synopsis; convert FeedPP properties to scalar context so that
blank fields are rendered properly.
This commit is contained in:
David Delikat 2009-01-23 03:41:49 +00:00
parent 2893944837
commit 16ce54bf4f
4 changed files with 61 additions and 8 deletions

View file

@ -548,11 +548,15 @@ sub getSynopsisAndContent {
my $synopsis = shift;
my $body = shift;
unless ($synopsis) {
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
my @content = split(/\^\-\;/,$body);
$synopsis = WebGUI::HTML::filter($content[0],"all");
my @content;
if( $body =~ /<p>/ ) {
@content = WebGUI::HTML::splitTag($body);
} else {
@content = split("\n",$body);
}
shift @content if $content[0] =~ /^\s*$/;
$synopsis = WebGUI::HTML::filter($content[0],"all");
}
$body =~ s/\^\-\;/\n/;
return ($synopsis,$body);
}