ParagraphFormat is not XHTML Safe
May 06, 2005
I just noticed that the ParagraphFormat tag is not XHTML safe. It inserts unclosed <P> tags for line breaks. I posted a comment on the live docs about this, so hopefully they will add an optional argument to have it generate XHTML output. Here's a function you can use in the meantime:
<cffunction name="XHTMLParagraphFormat" returntype="string" output="false"> <cfargument name="str" required="true" type="string"> <cfreturn REReplace(arguments.str, "\r+\n\r+\n", "<br /><br />", "ALL")> </cffunction>
Tweet
Trackbacks
Trackback Address: 344/E8DB007E15F145BBA1EB87FBC2A2795E
Comments
On 05/06/2005 at 7:22:15 PM EDT Steve Ray wrote:
1
There's also an XHTMLParagraphFormat UDF on CFLib.org.
On 05/06/2005 at 8:35:38 PM EDT Raymond Camden wrote:
2
There is a cflib function for this too. :)
On 02/03/2006 at 7:41:14 PM EST Brian G wrote:
3
The function on cflib is not exactly ideal. It will convert blank lines into empty <p></p> tags which is not exactly correct.
I changed the code from a replace to a reReplaceNoCase with the following regexp to do the right thing (from a semantic XHTML point of view):
reReplaceNoCase(string, "(#Chr(13)##Chr(10)#)+", ...)
Post a Comment
Recent Entries
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM


add to del.icio.us



