Last modified: 2010-07-08 20:29:01 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 T26182, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24182 - Trimming or removing all whitespace from returned template text is useful
Trimming or removing all whitespace from returned template text is useful
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
StringFunctionsEscaped (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Jack D. Pond
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-30 02:58 UTC by Dan Bolser
Modified: 2010-07-08 20:29 UTC (History)
2 users (show)

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


Attachments
Diff between r68758 and my changes. (2.54 KB, patch)
2010-06-30 02:58 UTC, Dan Bolser
Details

Description Dan Bolser 2010-06-30 02:58:58 UTC
Created attachment 7532 [details]
Diff between r68758 and my changes.

When you have a template that just sets some configuration or inserts a div, for example, it is often nice to leave lots of whitespace in the wiki code for readability. However, this will often affect the layout of the calling page.

Two new parser functions have been proposed to help deal with this issue (although there could be many different ways to deal with it).

<!-- Trim the whitespace from before and after 
     the text returned by 'template' -->

{{#trim: {{template}} }}


<!-- Remove *all* the whitespace from within 
     the text returned by 'template' -->

{{#nospaces: {{template}} }}




Attached is a diff that adds these two parser functions to the cleverly named ParserFunctions extension.
Comment 1 Dan Bolser 2010-07-01 02:04:41 UTC
Here is a 'working' version (see the tests):

http://bifx.org/~dmb/phase3/index.php/Main_Page
Comment 2 Jack D. Pond 2010-07-08 20:29:01 UTC
Fixed in r69197 (trunk) by creating a new parserfunction #stripnewlines as part of http://www.mediawiki.org/wiki/Extension:StringFunctionsEscaped.

Additional whitespace remove function deemed unnecessary by submitter.

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


Navigation
Links