Ironically, this tag has exactly the problem I illustrated, and
consequently will usually end up rendering a bunch of extra whitespace
itself.

cheers,
barneyb


On Tue, 22 Mar 2005 16:34:08 -0400, Andrew Grosset <[EMAIL PROTECTED]> wrote:
> >CF5/IIS5
> >
> >I have a CFML tag constructed to produce as little white space as
> >possible -
> 
> another way is to use this custom tag: StripWhiteSpace.cfm
> 
> <!--- ===================================================================== 
> --->
> <CFSETTING ENABLECFOUTPUTONLY="YES"><!--- Suspend whitespace output --->
> <CFPARAM NAME="Attributes.StrengthMode" DEFAULT="Maximum">
> 
>   <!--- Make sure a closing tag exists in calling template --->
>   <CFIF NOT ThisTag.HasEndTag>
>     <CFABORT SHOWERROR="You need to supply a closing <CF_FileWriteText> tag.">
>   </CFIF>
> 
>   <!--- When the closing tag is encountered... --->
>   <CFIF ThisTag.ExecutionMode is "End">
>     <!--- Replace multiple whitespace characters with a single space --->
>     <CFSWITCH EXPRESSION="#Attributes.StrengthMode#">
>       <CFCASE VALUE="Maximum">
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "[[:space:]]{2,}", " ", "ALL")>
>       </CFCASE>
>       <CFCASE VALUE="Literate">
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", 
> "#Chr(13)##Chr(10)#", "ALL")>
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "[ #Chr(9)#]{2,}", "", "ALL")>
>       </CFCASE>
>       <CFCASE VALUE="Medium">
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", 
> "#Chr(13)##Chr(10)#", "ALL")>
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "[ #Chr(9)#]{2,}", " ", "ALL")>
>       </CFCASE>
>       <CFCASE VALUE="Light">
>         <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, 
> "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", 
> "#Chr(13)##Chr(10)#", "ALL")>
>       </CFCASE>
>       <CFCASE VALUE="Off">
>       </CFCASE>
>       <CFDEFAULTCASE>
>         <CFABORT SHOWERROR="Error in CF_StripWhitespace tag. Invalid MODE 
> attribute.">
>       </CFDEFAULTCASE>
>     </CFSWITCH>
>   </CFIF>
> 
> <CFSETTING ENABLECFOUTPUTONLY="NO"><!--- Re-enable whitespace output --->
> <!--- ===================================================================== 
> --->
> 
> I'm not sure who originally wrote it, but it works well.
> 
> If you place it in the same directory as the calling template you can call it 
> like this:
> 
> <CF_StripWhitespace StrengthMode="maximum">
> <!--- your code goes here --->
> </CF_StripWhitespace>


-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199707
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to