Entries tagged with ‘formatting text’

Shaun Inman’s Widon’t Ported to Javascript

I was working on some pull-quote magic today (more on that later) and needed to de-widow a string in Javascript a la Shaun Inman’s Widon’t. So I ported it to Javascript. Here’s the magic: String.prototype.widont = function() { return this.replace(/([^\s])\s+([^\s]+)\s*$/, '$1 $2'); } // end widont() To use this simply call the widont() method on a […]

XHTMLParagraphFormat() Version 3

Version 3 of the previously posted XHTMLParagraphFormat() ColdFusion function has just been released. Thanks to visitor and commenter Christopher Lewis for drawing my attention to a minor bug. Get it while it’s hot: Download XHTMLParagraphFormat() Version 3 I’d love to hear if you end up using this function or if you have any suggestions, fixes, […]

XHTMLParagraphFormat Version 2

UPDATE (Oct 23, 2006): This version of XHTMLParagraphFormat() is out of date. If you wish, you should check out the latest version. Unfortunately, I found a major error in the previously posted XHTMLParagraphFormat() function that caused it to not work properly under many circumstances. However, after doing some more research and testing, I banged out […]

XHTMLParagraphFormat()

UPDATE (Oct 23, 2006): This version of XHTMLParagraphFormat() is out of date. If you wish, you should check out the latest version. While reworking the athletics site, I realized that it was time to improve our less than perfect method for displaying news stories as HTML. The first obvious solution for formatting a chunk of […]