Better handling for paragraphs in the SC. This code needs to be refactored out and generalized into a method that anything can use. Fixes bug #11563.
This commit is contained in:
parent
414e60380f
commit
3ae3684aea
3 changed files with 53 additions and 6 deletions
|
|
@ -316,10 +316,19 @@ sub getTemplateVariables {
|
|||
$item{descriptionFirst25words} =~ s/(((\S+)\s+){25}).*/$1/s;
|
||||
$item{descriptionFirst10words} = $item{descriptionFirst25words};
|
||||
$item{descriptionFirst10words} =~ s/(((\S+)\s+){10}).*/$1/s;
|
||||
$item{descriptionFirst2paragraphs} = $item{description};
|
||||
$item{descriptionFirst2paragraphs} =~ s/^((.*?\n){2}).*/$1/s;
|
||||
$item{descriptionFirstParagraph} = $item{descriptionFirst2paragraphs};
|
||||
$item{descriptionFirstParagraph} =~ s/^(.*?\n).*/$1/s;
|
||||
if ($description =~ /<p>/) {
|
||||
my $html = $description;
|
||||
$html =~ tr/\n/ /s;
|
||||
my @paragraphs = map { "<p>".$_."</p>" } WebGUI::HTML::splitTag($html,3);
|
||||
$item{descriptionFirstParagraph} = $paragraphs[0];
|
||||
$item{descriptionFirst2paragraphs} = join '', @paragraphs[0..1];
|
||||
}
|
||||
else {
|
||||
$item{descriptionFirst2paragraphs} = $item{description};
|
||||
$item{descriptionFirst2paragraphs} =~ s/^((.*?\n){2}).*/$1/s;
|
||||
$item{descriptionFirstParagraph} = $item{descriptionFirst2paragraphs};
|
||||
$item{descriptionFirstParagraph} =~ s/^(.*?\n).*/$1/s;
|
||||
}
|
||||
$item{descriptionFirst4sentences} = $item{description};
|
||||
$item{descriptionFirst4sentences} =~ s/^((.*?\.){4}).*/$1/s;
|
||||
$item{descriptionFirst3sentences} = $item{descriptionFirst4sentences};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue