Last modified: 2013-07-25 09:01:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32377, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30377 - Suggestion: add a new parameter to limit the number of characters when rendering the channel item <description>
Suggestion: add a new parameter to limit the number of characters when render...
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
RSS (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: T. Gries
http://www.mediawiki.org/wiki/Extensi...
:
Depends on: 34763
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-15 08:19 UTC by T. Gries
Modified: 2013-07-25 09:01 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description T. Gries 2011-08-15 08:19:55 UTC
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)
Comment 1 T. Gries 2012-02-13 07:24:48 UTC
added optional item-max-length attribute and $wgRSSItemMaxLength parameter.

fixed in r111350 .
Comment 2 T. Gries 2012-03-07 21:10:57 UTC
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,
Comment 3 T. Gries 2012-03-24 06:44:53 UTC
Suggestion for implementation: https://www.mediawiki.org/wiki/User_talk:Wikinaut#Rss_truncating_results_when_using_html_13489 .
Comment 4 Jesús Martínez Novo (Ciencia Al Poder) 2013-01-27 13:47:08 UTC
Gerrit change #3925
Comment 5 T. Gries 2013-01-27 16:47:17 UTC
(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 .
Comment 6 Andre Klapper 2013-07-24 10:29:15 UTC
(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.
Comment 7 T. Gries 2013-07-24 18:06:43 UTC
it is not solved yet.
Please leave open.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links