EE: Widon’t plugin

Low Widon’t — an ExpressionEngine plugin based on Shaun Inman’s neat little plugin for Wordpress. This post now provides a place for support for the Low Widon’t plugin.

Download and docs for Low Widon’t can be found in the Software section

August 29th 2006 | Add-Ons, ExpressionEngine | 10 comments

Comments

  1. 1 Milo August 29th 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. 2 Nick August 31st 2006, 14:56

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

  3. 3 Low August 31st 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. 4 Dan April 11th 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 !!”.

  5. 5 Phil+ April 8th 2009, 05:19

    GREAT Plugin! Thanks so much!!

  6. 6 David Wall August 7th 2009, 20:34

    Hi! Thanks for making this.
    Just wondering why you limited it to titles though? It would be really useful on other paragraphs too.

  7. 7 Anthony DeCrescenzo September 6th 2009, 02:32

    Wanted to let you know that the plugin (EE version) was failing when there was trailing punctuation on a title (or anything, really.)

    For example, the title:

    My Very Very Happy
    Birthday!

    would not fix itself because of the final punctuation.

    I modified the regex to:

    (”|\s+(\w+[^A-Za-z0-9\n]*)$|”, ‘ \1′, rtrim($str));</pre>

    …and it seems to stop this particular failure.
    FYI, and thanks for a great port!

  8. 8 Anthony DeCrescenzo September 6th 2009, 02:37

    Just noticed Dan’s post from (urgh) 2 years ago that I somehow missed. His is probably the more elegant regex, if elegance is important to you and all, sissy-coders!

    ;-)

  9. 9 Alex Roper September 3rd 2010, 22:03

    I’m trying to use this on a block of copy:

    {exp:low_widont}{content}{/exp:low_widont}

    But it looks like this only check for the last word in the entire tag, not the last word in each paragraph for example. Is there any way to do this?

  10. 10 Low September 13th 2010, 11:07

    Alex, I don’t think there is a simple way to do this, actually. It will require some expert regular expression mojo, if it can be done at all.

Commenting is not available in this weblog entry.