i think there is some code on cflib
 
This is the one i use....
 
 
<cffunction name="colorCode" output="No">
        <cfargument name="data" required="Yes">
        
        <cfset var thisData = "" />
        <cfset var EOF = 0 />
        <cfset var BOF = 1 />
        <CFSCRIPT>
                                /* Pointer to Attributes.Data */
                                thisData = Arguments.Data;
                        
                                /* Convert special characters so they do not
get interpreted literally; italicize and boldface */
                                thisData = REReplaceNoCase(thisData,
"&([[:alpha:]]{2,});", "<B><I>&amp;\1;</I></B>", "ALL");
                        
                                /* Convert many standalone (not within
quotes) numbers to blue, ie. myValue = 0 */
                                thisData = REReplaceNoCase(thisData,
"(gt|lt|eq|is|,|\(|\))([[:space:]]?[0-9]{1,})", "\1<FONT
COLOR=BLUE>\2</FONT>", "ALL");
                        
                                /* Convert normal tags to navy blue */
                                thisData = REReplaceNoCase(thisData,
"<(/?)((!d|b|c(e|i|od|om)|d|e|f(r|o)|h|i|k|l|m|n|o|p|q|r|s|t(e|i|t)|u|v|w|x)
[^>]*)>", "<FONT COLOR=NAVY><\1\2></FONT>", "ALL");
                        
                                /* Convert all table-related tags to teal */
                                thisData = REReplaceNoCase(thisData,
"<(/?)(t(a|r|d|b|f|h)([^>]*)|c(ap|ol)([^>]*))>", "<FONT
COLOR=TEAL><\1\2></FONT>", "ALL");
                        
                                /* Convert all form-related tags to orange
*/
                                thisData = REReplaceNoCase(thisData,
"<(/?)((bu|f(i|or)|i(n|s)|l(a|e)|se|op|te)([^>]*))>", "<FONT
COLOR=FF8000><\1\2></FONT>", "ALL");
                        
                                /* Convert all tags starting with 'a' to
green, since the others aren't used much and we get a speed gain */
                                thisData = REReplaceNoCase(thisData,
"<(/?)(a[^>]*)>", "<FONT COLOR=GREEN><\1\2></FONT>", "ALL");
                        
                                /* Convert all image and style tags to
purple */
                                thisData = REReplaceNoCase(thisData,
"<(/?)((im[^>]*)|(sty[^>]*))>", "<FONT COLOR=PURPLE><\1\2></FONT>", "ALL");
                        
                                /* Convert all ColdFusion, SCRIPT and WDDX
tags to maroon */
                                thisData = REReplaceNoCase(thisData,
"<(/?)((cf[^>]*)|(sc[^>]*)|(wddx[^>]*))>", "<FONT
COLOR=MAROON><\1\2></FONT>", "ALL");
                        
                                /* Convert all inline "//" comments to gray
(revised) */
                                thisData = REReplaceNoCase(thisData,
"([^:/]\/{2,2})([^[:cntrl:]]+)($|[[:cntrl:]])", "<FONT
COLOR=GRAY><I>\1\2</I></FONT>", "ALL");
                        
                                /* Convert all multi-line script comments to
gray */
                                thisData = REReplaceNoCase(thisData,
"(\/\*[^\*]*\*\/)", "<FONT COLOR=GRAY><I>\1</I></FONT>", "ALL");
                        
                                /* Convert all HTML and ColdFusion comments
to gray */      
                                /* The next 10 lines of code can be replaced
with the commented-out line following them, if you do care whether HTML and
CFML 
                                   comments contain colored markup. */
                                
                                while(NOT EOF) {
                                        Match =
REFindNoCase("<!---?([^-]*)-?-->", thisData, BOF, True);
                                        if (Match.pos[1]) {
                                                Orig = Mid(thisData,
Match.pos[1], Match.len[1]);
                                                Chunk =
REReplaceNoCase(Orig, "<(/?[^>]*)>", "", "ALL");
                                                BOF = ((Match.pos[1] +
Len(Chunk)) + 31); // 31 is the length of the FONT tags in the next line
                                                thisData = Replace(thisData,
Orig, "<FONT COLOR=GRAY><I>#Chunk#</I></FONT>");
                                        } else EOF = 1;
                                }
                        
                                // Use thisData next line of code instead of
the last 10 lines if you want (faster)
                                // thisData = REReplaceNoCase(thisData,
"(<!---?[^-]*-?-->)", "<FONT COLOR=GRAY><I>\1</I></FONT>", "ALL");
                        
                                /* Convert all quoted values to blue */
                                thisData = REReplaceNoCase(thisData,
"""([^""]*)""", "<FONT COLOR=BLUE>""\1""</FONT>", "ALL");
                        
                                /* Convert left containers to their ASCII
equivalent */
                                thisData = REReplaceNoCase(thisData, "<",
"&lt;", "ALL");
                        
                                /* Revert all pseudo-containers back to
their real values to be interpreted literally (revised) */
                                thisData = REReplaceNoCase(thisData,
"<([^>]*)>", "<\1>", "ALL");
                        
                                /* ***New Feature*** Convert all FILE and
UNC paths to active links (i.e, file:///, \\server\, c:\myfile.cfm) */
                                thisData = REReplaceNoCase(thisData,
"(((file:///)|([a-z]:\\)|(\\\\[[:alpha:]]))+(\.?[[:alnum:]\/[EMAIL 
PROTECTED]|:~`+$%?_##&
-])+)", "<A TARGET=""_blank"" HREF=""\1"">\1</A>", "ALL");
                        
                                /* Convert all URLs to active links
(revised) */
                                //thisData = REReplaceNoCase(thisData,
"([[:alnum:]]*://[[:alnum:[EMAIL 
PROTECTED](\.[[:alnum:]][[:alnum:]-]*[[:alnum:]]\.)?[[
:alnum:]]{2,}(\.?[[:alnum:]\/[EMAIL PROTECTED]|:~`+$%?_##&-])+)", "<A 
TARGET=""_blank""
HREF=""\1"">\1</A>", "ALL");
                        
                                /* Convert all email addresses to active
mailto's (revised) */
                                //thisData = REReplaceNoCase(thisData,
"(([[:alnum:]][[:alnum:]_.-]*)?[[:alnum:[EMAIL 
PROTECTED]:alnum:]][[:alnum:].-]*\.[[:alp
ha:]]{2,})", "<A HREF=""mailto:\1"";>\1</A>", "ALL");
                        </CFSCRIPT>

                <cfreturn thisData>
</cffunction>








________________________________

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Thursday, 2 August 2007 8:47 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: ColdFusion Code Highlighting



Yes,

 

I realise that, but I want to use it. I'm not sure if Ray wrote it or just
uses it, i'm pretty sure I cant just pinch it out of Blog CFC, Id rather
find the developer and check the licence.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Haikal Saadh
Sent: Thursday, 2 August 2007 7:00 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: ColdFusion Code Highlighting

 


You just answered you own question: http://blogcfc.riaforge.org/

Dale Fraser wrote: 

Thanks Taco,

 

But I'm referring to the type of thing that Blog CFC does, formats and color
codes CF code, there is probably a legitimate source for this somewhere.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

 





 






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to