Suggestion: add a new parameter to limit the number of characters when rendering the channel item <description>
Open, NormalPublic

Description

We need to introduce an optional parameter, and a default value to limit the number of characters. An implementation idea has been posted in 2010 on http://www.mediawiki.org/wiki/Extension_talk:RSS#How_to_modify_the_length_of_the_description.3F and is partially copied here:

How to modify the length of the description?

Something like this:

preg_replace('/^(.{150}).{3,}(.{25})$/us', '$1 ... $2', $item['description']);

Play around with the numbers and you'll see. --Subfader 21:48, 5 March 2010 (UTC)

        I changed rss.php a lot so I didn't check it, but it should work like this: Replace

if ( $item['description'] ) {
$text = trim( iconv( $charset, $wgOutputEncoding, $item['description'] ) );

with

if ( $item['description'] ) {
$shortdesc = preg_replace('/^(.{150}).{3,}(.{25})$/us', '$1 ... $2', $item['description']);
$text = trim( iconv( $charset, $wgOutputEncoding, $shortdesc ) );

This will shorten the description text to [150 chars ... 25 chars]. --Subfader 19:15, 16 March 2010 (UTC)


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/Extension:RSS

Details

Reference
bz30377
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz30377.
Wikinaut created this task.Aug 15 2011, 8:19 AM

added optional item-max-length attribute and $wgRSSItemMaxLength parameter.

fixed in r111350 .

must reopen it, because I need to deactivate the itme string length limitation in controlled form for solving bug34763 in r113297.

Rationale:

Feed item string length limitation is difficult when we allow HTML <a> or <img> tags, because a mere content-unaware limitation breaks (can break) tags which results in disastrous rendering results.

Solution will sought later,

gerrit change 3925

(In reply to comment #4)

Gerrit change #3925

Just a warning, the feed-item length limitation (part of my pending patch) is not finally solved, because a simple "blind" truncation to a certain number of characters can break HTMLs, which is undesired. This is just a warning, and I will work on that specific issue later (when the #3925 is merged).

Thanks for your interests and adding a link to the https://gerrit.wikimedia.org/r/3925 .

(In reply to comment #5)

Just a warning, the feed-item length limitation (part of my pending patch) is
not finally solved, because a simple "blind" truncation to a certain number
of
characters can break HTMLs, which is undesired. This is just a warning, and I
will work on that specific issue later (when the #3925 is merged).

T. Gries: Is there a followup bug or gerrit change for this?

Closing this bug report as the corresponding Gerrit patch has been merged.

it is not solved yet.
Please leave open.

Aklapper removed Wikinaut as the assignee of this task.Jun 18 2015, 2:08 PM
Aklapper added a subscriber: Aklapper.

[Resetting task assignee to avoid cookie-licking. Please reclaim the task when you plan to actively work on this task. Thanks!]