XHTMLParagraphFormat() Posted on January 30th, 2006 by

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 text is ColdFusion’s built-in ParagraphFormat(), but it is not perfect because it doesn’t return valid XHTML. A quick Google search brought me to some XHTMLParagraphFormat functions that were ok, but didn’t fit the needs of the project. I was looking for a function that would take a chunk of text with some possible XHTML already mixed in (for lists and headings and such) and nicely put paragraphs into paragraphs and give single line breaks their <br/>.

Introducing XHTMLParagraphFormat(). While this function hasn’t been entirely tested yet and I am sure that there are some bugs, it has been working quite well in our beta application.

Here’s the download.

Please let me know if you end up using this function. And if you have any suggestions, please leave them in the comments.

 


2 Comments

  1. CL says:

    I’d love to see Joe’s XHTMLParagraphFormat() but I’m getting this error: Fatal error: Call to undefined function: buildbreadcrumbtrailxhml() in /cis/www/gts/webservices/wp-content/themes/gustavus/footer.php on line 4

  2. Joe Lencioni says:

    CL: Thanks for letting us know about the broken link. It should work just fine now.