Page MenuHomePhabricator

long words should be broken in image gallery descriptions
Closed, ResolvedPublic

Description

Single words that are longer than the width of the image thumbnail in image
galleries should be automatically hyphenated and split onto more than one line.
At present the word displays ontop of the caption of the image(s) to the right.
For an example see
http://commons.wikimedia.org/wiki/Train_station#Station_buildings_United_Kingdom
where the word Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch means
you cannot see the first line of the caption for the image to the right (in this
case "Llangollen station, north"


Version: unspecified
Severity: enhancement

Details

Reference
bz3770

Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:53 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz3770.
bzimport added a subscriber: Unknown Object (MLST).

From
http://petesbloggerama.blogspot.com/2007/02/firefox-ie-word-wrap-word-break-tables.html
it looks like the following css can do the job:

white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */

With css3 we could probably use something like:

word-break: normal;

ayg wrote:

Those attributes control breaking between words, not within them. They do not
cover hyphenation, which to my knowledge is supported by no major browser today
without hint characters like ­ (and that not by Firefox at least, last I
heard, probably not IE either). We would have to guess at a pixel width for
letters and manually add hyphens and line breaks on the server side where
appropriate. Rather a large ordeal, but I'm sure there's a FLOSS hyphenation
program somewhere that could be integrated into MW if someone wants to do it.

ayg wrote:

(In reply to comment #2)

Those attributes control breaking between words, not within them. They do not
cover hyphenation, which to my knowledge is supported by no major browser today
without hint characters like ­ (and that not by Firefox at least, last I
heard, probably not IE either). We would have to guess at a pixel width for
letters and manually add hyphens and line breaks on the server side where
appropriate. Rather a large ordeal, but I'm sure there's a FLOSS hyphenation
program somewhere that could be integrated into MW if someone wants to do it.

But note that this would break copy-pasting. The hyphen would be copied. I
would be inclined, actually, to say that this should either be done
transparently by the browser (preserving copy-paste, search, ...) or manually by
editors where strictly needed. We just aren't in a position to do this
intelligently. WONTFIX?

made a confusion between word-wrap and hyphenate. There is nothing on
going at the moment :

http://www.w3.org/TR/css3-text/#hyphenate

Something involving 'word-wrap: break-word' may improve the behavior on IE and Safari; currently it's still a little weird for table behavior. Something similar to the recent diff changes might be required, or otherwise different layout for the gallery as with other requests...

Marking as depending on Bug 3276 , since word-wrap: break-word doesn't always work in <td> and 3267 get's rid of the tables