Page MenuHomePhabricator

Automatically remove redundant whitespace, eg. double spaces
Closed, DeclinedPublic

Description

Author: wikimedia-bugzilla

Description:
Annoyingly, many editors use two spaces between sentences. This is ignored when
the page is rendered; how about automatically removing redundant whitespace like
this when edits are submitted?


Version: unspecified
Severity: enhancement

Details

Reference
bz2312

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 8:35 PM
bzimport set Reference to bz2312.
bzimport added a subscriber: Unknown Object (MLST).

What benefit would this have?

Note that not all multiple whitespace is redundant, eg in preformatted text.

Inclined to WONTFIX this.

magnusrk+wiki wrote:

There are more general cases where double newlines are needed. To get whitespace between a list and a heading you need two empty lines. One
line has the same effect as zero. My understanding is that the list isn't a paragraph, so you need the first newline to kick the parser
into paragraph mode.

And as a general case, I don't want the wiki to change the source unless I tell it to.

gangleri wrote:

in response to #c2
at
http://test.leuksman.com/index.php?title=User:Gangleri/tests/sandbox#Template:Forced_new_line
I tried to find a way to generate new lines using a temlate containing
: 
(colon and non breaking space)

This works there (in CVS) but does not at [[en:User talk:Patrick#Template:Forced
new line]]. Does anybody know why and can provide another solution?

Regards Reinhardt [[user:gangleri]]

Closing as WONTFIX.

Gangleri, that's totally unrelated to this issue.

wikimedia-bugzilla wrote:

Re comment #1 and comment #2
I said remove *redundant* whitespace... let's just focus on double spaces
between sentences: always redundant. This could be easily removed. Benefits:
Make wikitext more standard, easier to read, and save other people from removing
it manually.

rowan.collins wrote:

(In reply to comment #5)

I said remove *redundant* whitespace... let's just focus on double spaces
between sentences: always redundant.

Not always:

  • "<pre>foo bar</pre>"
  • the lines-beginning-with-a-space wiki markup ("\n foo bar\n")
  • <math>, <hiero>, etc

While all these situations *can* be detected, and already are in various parts
of the code, it's not actually as trivial as "remove all double spaces".

The benefits you list don't really outweigh the effort of coding this correctly
(and introducing yet more complication into the already bloated parsing code)
and are questionable even in themselves:

  • the wikitext would be "more standard" in such a subtle way that no-one would

probably notice, while all sorts of more obvious things remained variable

  • personally, I find double-spaces between sentences *easier* to read - as,

presumably, do the other editors who have a habit of inserting them

  • and, frankly, anyone who feels compelled to make such trivial changes is only

getting what they ask for in terms of wasted effort - since it makes no
difference to anything, why not just leave it alone? [That's only an opinion,
obviously, but I certainly wouldn't spend my time *inserting* double spaces,
knowing that they wouldn't show up.]