EE: widon’t plugin

Shaun Inman created this neat little plugin for Wordpress to eliminate widows from post titles. Don’t know what widows are, apart from the female kind? Mr Inman explains:

In typesetting, a widow is a single word on a line by itself at the end of a paragraph and is considered bad style.

And we don’t like bad style, do we? So I guess that plugin needed porting to ExpressionEngine.

→ Download the Widon’t plugin for EE.

Installation

Unzip and upload the file to your system/plugins folder and you’re ready to roll.

Usage

The best way to use this plugin is with your entry titles, thus:

{exp:widont}{title}{/exp:widont}

This way, the last space in the title will be replaced with a non-breaking space ( ), eliminating the widow.

Comments

  1. author
    1 Milo 29 augustus 2006, 23:19

    Wow, I never knew there was a name for such a thing, but I sure have been annoyed by it for a while. Now that I know what it’s called I feel inspired to implement a similar hack on my own site :)

  2. author
    2 Nick 31 augustus 2006, 14:56

    Why not use white-space: nowrap on title headings?

  3. author
    3 Low 31 augustus 2006, 15:03

    @Nick: heh, the same question was asked over at Shaun’s site. The point is, we just want the last two words to stick together, not the whole line/title/text. That way the width of your layout (often more important than the height) will be safe.

  4. author
    4 Dan 11 april 2007, 13:16

    Hi there,

    Great plugin but i’d like to mention a small change to the regular expression that is needed if any of your titles/strings end with any sort of punctuation.

    Instead of |\s+(\w+)$| which matches any whitespace followed by any word character(s) use |\s+(\S+)$| which matches any whitespace followed by any non whitespace (visible) character. This has the benefit of also pairing and ending such as “my entry !!”.

Leave a comment

Some html (a, em, strong, etc) allowed.


Zoeken in loweblog.com