Remove HTML from SC sentences and words template variables, and any initial whitespace. Fixes bug #11589.
This commit is contained in:
parent
9cfcf84c2f
commit
ab0204dfd9
4 changed files with 42 additions and 32 deletions
|
|
@ -305,17 +305,19 @@ sub getTemplateVariables {
|
|||
$item{guid} = WebGUI::HTML::filter(scalar $object->guid, 'javascript');
|
||||
$item{link} = WebGUI::HTML::filter(scalar $object->link, 'javascript');
|
||||
my $description = WebGUI::HTML::filter(scalar($object->description), 'javascript');
|
||||
my $raw_description = WebGUI::HTML::filter($description, 'all');
|
||||
$raw_description =~ s/^\s+//s;
|
||||
$item{description} = defined $description ? $description : '';
|
||||
$item{descriptionFirst100words} = $item{description};
|
||||
$item{descriptionFirst100words} =~ s/(((\S+)\s+){100}).*/$1/s;
|
||||
$item{descriptionFirst100words} = $raw_description;
|
||||
$item{descriptionFirst100words} =~ s/(((\S+)\s+){1,100}).*/$1/ms;
|
||||
$item{descriptionFirst75words} = $item{descriptionFirst100words};
|
||||
$item{descriptionFirst75words} =~ s/(((\S+)\s+){75}).*/$1/s;
|
||||
$item{descriptionFirst75words} =~ s/(((\S+)\s+){1,75}).*/$1/ms;
|
||||
$item{descriptionFirst50words} = $item{descriptionFirst75words};
|
||||
$item{descriptionFirst50words} =~ s/(((\S+)\s+){50}).*/$1/s;
|
||||
$item{descriptionFirst50words} =~ s/(((\S+)\s+){1,50}).*/$1/ms;
|
||||
$item{descriptionFirst25words} = $item{descriptionFirst50words};
|
||||
$item{descriptionFirst25words} =~ s/(((\S+)\s+){25}).*/$1/s;
|
||||
$item{descriptionFirst25words} =~ s/(((\S+)\s+){1,25}).*/$1/ms;
|
||||
$item{descriptionFirst10words} = $item{descriptionFirst25words};
|
||||
$item{descriptionFirst10words} =~ s/(((\S+)\s+){10}).*/$1/s;
|
||||
$item{descriptionFirst10words} =~ s/(((\S+)\s+){1,10}).*/$1/ms;
|
||||
if ($description =~ /<p>/) {
|
||||
my $html = $description;
|
||||
$html =~ tr/\n/ /s;
|
||||
|
|
@ -329,12 +331,12 @@ sub getTemplateVariables {
|
|||
$item{descriptionFirstParagraph} = $item{descriptionFirst2paragraphs};
|
||||
$item{descriptionFirstParagraph} =~ s/^(.*?\n).*/$1/s;
|
||||
}
|
||||
$item{descriptionFirst4sentences} = $item{description};
|
||||
$item{descriptionFirst4sentences} =~ s/^((.*?\.){4}).*/$1/s;
|
||||
$item{descriptionFirst4sentences} = $raw_description;
|
||||
$item{descriptionFirst4sentences} =~ s/^((.*?\.){1,4}).*/$1/s;
|
||||
$item{descriptionFirst3sentences} = $item{descriptionFirst4sentences};
|
||||
$item{descriptionFirst3sentences} =~ s/^((.*?\.){3}).*/$1/s;
|
||||
$item{descriptionFirst3sentences} =~ s/^((.*?\.){1,3}).*/$1/s;
|
||||
$item{descriptionFirst2sentences} = $item{descriptionFirst3sentences};
|
||||
$item{descriptionFirst2sentences} =~ s/^((.*?\.){2}).*/$1/s;
|
||||
$item{descriptionFirst2sentences} =~ s/^((.*?\.){1,2}).*/$1/s;
|
||||
$item{descriptionFirstSentence} = $item{descriptionFirst2sentences};
|
||||
$item{descriptionFirstSentence} =~ s/^(.*?\.).*/$1/s;
|
||||
push @{$var{item_loop}}, \%item;
|
||||
|
|
|
|||
|
|
@ -280,48 +280,48 @@ Feed Order: Items will be in the order they appeared in the feed}
|
|||
},
|
||||
|
||||
'descriptionFirst100words' => {
|
||||
message => q{The first 100 words of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 100 words of the description, with all HTML removed.},
|
||||
lastUpdated => 1274815483,
|
||||
},
|
||||
'descriptionFirst75words' => {
|
||||
message => q{The first 75 words of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 75 words of the description, with all HTML removed.},
|
||||
lastUpdated => 1274815485,
|
||||
},
|
||||
'descriptionFirst50words' => {
|
||||
message => q{The first 50 words of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 50 words of the description, with all HTML removed.},
|
||||
lastUpdated => 1274815486,
|
||||
},
|
||||
'descriptionFirst25words' => {
|
||||
message => q{The first 25 words of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 25 words of the description, with all HTML removed.},
|
||||
lastUpdated => 1274815488,
|
||||
},
|
||||
'descriptionFirst10words' => {
|
||||
message => q{The first 10 words of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 10 words of the description, with all HTML removed.},
|
||||
lastUpdated => 1274815490,
|
||||
},
|
||||
'descriptionFirst2paragraphs' => {
|
||||
message => q{The first 2 paragraphs of the description.},
|
||||
message => q{The first 2 paragraphs of the description, with all HTML removed.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'descriptionFirstParagraph' => {
|
||||
message => q{The first paragraph of the description.},
|
||||
message => q{The first paragraph of the description, with all HTML removed.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'descriptionFirst4sentences' => {
|
||||
message => q{The first 4 sentences of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 4 sentences of the description, with all HTML removed.},
|
||||
lastUpdated => 1274816277,
|
||||
},
|
||||
'descriptionFirst3sentences' => {
|
||||
message => q{The first 3 sentences of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 3 sentences of the description, with all HTML removed.},
|
||||
lastUpdated => 1274816276,
|
||||
},
|
||||
'descriptionFirst2sentences' => {
|
||||
message => q{The first 2 sentences of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first 2 sentences of the description, with all HTML removed.},
|
||||
lastUpdated => 1274816274,
|
||||
},
|
||||
'descriptionFirstSentence' => {
|
||||
message => q{The first sentence of the description.},
|
||||
lastUpdated => 0,
|
||||
message => q{The first sentence of the description, with all HTML removed.},
|
||||
lastUpdated => 1274816273,
|
||||
},
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue