BlogCFC ColdFish Code Block Print Function Update

Normally I pay quite a bit of attention to my site after I do any major updates or changes but I've been quite a slacker lately and I seemed to have missed a few issues that happened after I updated my blog core ... Bad me.

Something interesting that I truly thought would be an isolated incident - and my problem - actually wasn't. It seems that there was a bug where Gecko based browsers - Firefox - don't seem to like the window.frames[] syntax ... So, for those that are using BlogCFC and want to be able to print code blocks from Firefox ... You may need to update the formatter.cfc with the new syntax ... Here's the link for the formatter.cfc ... on RIAForge ... or you can simply copy the update from here ...

view plain print about
1<!---
2    Copyright 2009 Jason Delmore
3    All rights reserved.
4    jason@cfinsider.com
5    
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU Lesser General Public License (LGPL) as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public License    
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18    --->

19<cfcomponent output="false">
20    <cffunction name="init" access="public" hint="This function initializes all of the variables needed for the component." output="false">
21        <cfscript>
22            //initialize a buffer
23
                
24            // If you're using JDK 1.5 or later and want some extra performance this can be a StringBuilder
25
            //variables.buffer=createObject("java","java.lang.StringBuilder").init();
26
            variables.buffer=createObject("java","java.lang.StringBuffer").init();
27            
28            // initialize private variables
29
            // TODO : Change the parser state to be a struct rather than individual variables.
30
            variables.isCommented=false;
31            variables.isTag=false;
32            variables.isValue=false;
33            variables.isCFSETTag=false;
34            variables.isCFScript=false;
35            variables.isCFQueryTag=false;
36            variables.isOneLineComment=false;
37            variables.isMXML=false;
38            variables.isActionscript=false;
39            variables.isSQL=false;
40            variables.isSQLValue=false;
41            variables.initialparser="";
42            variables.spansOpened = 0;
43            variables.spansClosed = 0;
44        
</cfscript>
45        <cfreturn this/>
46    </cffunction>
47    
48    <cffunction name="getHTMLOutput" access="public" hint="This function accepts a block of code and formats it into syntax highlighted HTML." output="false">
49        <cfargument name="code" type="string"/>
50        <cfargument name="parser" type="string"/>
51        <cfargument name="codesig" type="string"/>
52        <cfscript>
53            var BIstream = createObject("java","java.io.StringBufferInputStream").init(arguments.code);
54            var IStream = createObject("java","java.io.InputStreamReader").init(BIstream);
55            var reader = createObject("java","java.io.BufferedReader").init(IStream);
56            var line = reader.readLine();
57            var linenumber = 0;
58            
59            if (arguments.parser neq ""{
60                "variables.is#arguments.parser#" = true;
61            }
62            
63            if (getConfig().getShowToolbar()) {
64                variables.buffer.append(getToolbarHTML(arguments.code,arguments.codesig));            
65            }
66            
67            variables.buffer.append("<span id='formatted_code_" & arguments.codesig & "' style='" & getStyle("TEXT") & "'>");
68            while isdefinedd("line")) {
69                if (getConfig().getShowLineNumbers()) {
70                    linenumber = linenumber + 1;
71                    variables.buffer.append("<span style='" & getStyle("LINENUMBER") & "'>" & linenumber & "</span>");
72                }
73                formatLine(line);
74                line = reader.readLine();
75            }
76            // there appears to be more spans created than cleaned up... closing up any extras... will need to review to see what is keeping extra spans
77
            while (variables.spansOpened gt variables.spansClosed) {
78                variables.spansClosed = variables.spansClosed + 1;
79                variables.buffer.append("</span>");
80            }
81            variables.buffer.append("</span>");
82            reader.close();
83
84            return variables.buffer;
85        
</cfscript>
86    </cffunction>
87    
88    <cffunction name="getToolbarHTML" access="private" output="true">
89        <cfargument name="code" type="string"/>
90        <cfargument name="codesig" type="string"/>
91        <cfset var toolbarHTML = ""/>
92        <cfsavecontent variable="toolbarHTML">
93            <iframe id='print_frame_#arguments.codesig#' style='display:inline;height:0px;width:0px;' frameborder='0'></iframe>
94            <script type='text/javascript'>
95                function toggle_view_#arguments.codesig#() {
96                    var temp = document.getElementById('htmlencoded_plain_#arguments.codesig#').style.display;
97                    document.getElementById('htmlencoded_plain_#arguments.codesig#').style.display=document.getElementById('formatted_code_#arguments.codesig#').style.display;
98                    document.getElementById('formatted_code_#arguments.codesig#').style.display=temp;
99                    if (temp=='none') {
100                        document.getElementById('view_#arguments.codesig#').innerHTML='view formatted';
101                    } else {
102                        document.getElementById('view_#arguments.codesig#').innerHTML='view plain';
103                    }
104                }
105                function copy_to_clipboard_#arguments.codesig#() {
106                    var code=unescape(document.getElementById('htmlencoded_plain_#arguments.codesig#').innerHTML).replace(/&lt;/g, '\x3C').replace(/&gt;/g, '\x3E').replace(/&amp;/g, '\x26').replace(/\x3Cbr\x3E/gi, '\r\n').replace(new RegExp('&nbsp;&nbsp;&nbsp;&nbsp;', 'gi'), '\t');
107                    window.clipboardData.setData('text',code);
108                }
109                function print_#arguments.codesig#() {
110                    document.getElementById("print_frame_#arguments.codesig#").contentWindow.document.body.innerHTML = document.getElementById('formatted_code_#arguments.codesig#').innerHTML;
111                    document.getElementById("print_frame_#arguments.codesig#").contentWindow.focus();
112                    document.getElementById("print_frame_#arguments.codesig#").contentWindow.print();
113                }
114                function show_about_#arguments.codesig#() {
115                    document.getElementById('about_#arguments.codesig#').style.display='inline';
116                    window.setTimeout('hide_about_#arguments.codesig#();', 4000);
117                }
118                function hide_about_#arguments.codesig#() {
119                    document.getElementById('about_#arguments.codesig#').style.display='none';
120                }
121            </script>
122            <div style='#getStyle("TOOLBAR")#'>
123                <span style='margin:0 0 0 2em'/>
124                <!--- Toggle code view --->
125                <a href='javascript:toggle_view_#arguments.codesig#()' style='#getStyle("TOOLBARLINK")#' id='view_#arguments.codesig#'>view plain</a>
126                
127                <!--- Copy to clipboard --->
128                <a href='javascript:copy_to_clipboard_#arguments.codesig#()' style='display:none;#getStyle("TOOLBARLINK")#' id='view_copy_to_clipboard_link_#arguments.codesig#'>copy to clipboard</a>
129                <!--- The cross-browser copy to clipboard methods out there are hacky and only work on certain browsers... if the browser handles it, then the link show up... --->
130                <script type='text/javascript'>if(window.clipboardData) { document.getElementById('view_copy_to_clipboard_link_#arguments.codesig#').style.display='inline';}</script>
131                
132                <!--- Print --->
133                <a href='javascript:print_#arguments.codesig#()' style='#getStyle("TOOLBARLINK")#'>print</a>
134                
135                <!--- About --->
136                <a href='javascript:show_about_#arguments.codesig#()' style='#getStyle("TOOLBARLINK")#'>about</a>
137                
138            </div>
139            <span id='about_#arguments.codesig#' style='display:none;#getStyle("TEXT")#'><span style='#getStyle("LINENUMBER")#'>&nbsp;</span>&nbsp;ColdFISH is developed by Jason Delmore.  Source code and license information available at <a href='http://coldfish.riaforge.org/'>coldfish.riaforge.org</a><br/></span>
140            <span id='htmlencoded_plain_#arguments.codesig#' style='display:none;#getStyle("TEXT")#'>#REReplace(REReplace(htmleditformat(arguments.code), "\n", "<br />", "ALL"),"\t","&nbsp;&nbsp;&nbsp;&nbsp;","ALL")#</span>
141        </cfsavecontent>
142        <cfreturn toolbarHTML/>
143    </cffunction>
144    
145    <cffunction name="formatLine" access="private" hint="This function takes a single line of code and formats it into syntax highlighted HTML." output="false">
146        <cfargument name="line" type="any"/>
147        <cfscript>
148            var character = "";
149            var thisLine=arguments.line;
150            var i = 0;
151            var endtagPos = 0;
152            var startAttributePos = 0;
153            var keywordskip = 0;
154
155            
156            if (variables.isOneLineComment) endOneLineComment();
157            
158            for (i=0; i LT thisLine.length(); i=i+1)
159            {
160                character=thisLine.charAt(javacast('int',i));
161                if (character EQ '
<')
162                {
163                    if (variables.isCFScript AND NOT variables.isValue)
164                        endCFScript();
165                    if (regionMatches(thisLine, 1, i+1, "!--", 0, 3))
166                    {
167                        if (regionMatches(thisLine, 1, i+4, "-", 0, 1))
168                        {
169                            startComment("CF");
170                        } else {
171                            startComment("HTML");
172                        }
173                    } else {
174                        if (regionMatches(thisLine, 1, i+1, "CF", 0, 2) OR regionMatches(thisLine, 1, i+1, "/CF", 0, 3))
175                        {
176                            startTag("CF");
177                            if (regionMatches(thisLine, 1, i+3, "SET", 0, 3) AND NOT regionMatches(thisLine, 1, i+6, "T", 0, 1)) // CFSET Tag
178                            {
179                                variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',i+6)));
180                                i=i+5;
181                                startCFSET();
182                            }
183                            else if (regionMatches(thisLine, 1, i+3, "SCRIPT>", 0, 6)) // CFSCRIPT TAG
184                            {
185                                variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',i+9)) & "&gt;");
186                                i=i+9;
187                                startCFScript();
188                            }
189                            else if (regionMatches(thisLine, 1, i+3, "QUERY", 0, 5)) // START CFQUERY TAG
190                            {    // TODO: This sets the value color immediately to match SQL values including the CFQuery tag...
191                                variables.isCFQueryTag = true;
192                            } else if (regionMatches(thisLine, 1, i+4, "QUERY", 0, 5)) // END CFQUERY TAG
193                            {
194                                variables.isCFQueryTag = false;
195                                endSQL();
196                            }
197                        }
198                        else if    (
199                                     regionMatches(thisLine, 1, i+1, "TA", 0, 2) OR
200                                    regionMatches(thisLine, 1, i+1, "/TA", 0, 3) OR
201                                    regionMatches(thisLine, 1, i+1, "TB", 0, 2) OR
202                                    regionMatches(thisLine, 1, i+1, "/TB", 0, 3) OR
203                                    regionMatches(thisLine, 1, i+1, "TD", 0, 2) OR
204                                    regionMatches(thisLine, 1, i+1, "/TD", 0, 3) OR
205                                    regionMatches(thisLine, 1, i+1, "TF", 0, 2) OR
206                                    regionMatches(thisLine, 1, i+1, "/TF", 0, 3) OR
207                                    regionMatches(thisLine, 1, i+1, "TH", 0, 2) OR
208                                    regionMatches(thisLine, 1, i+1, "/TH", 0, 3) OR
209                                    regionMatches(thisLine, 1, i+1, "TR", 0, 2) OR
210                                    regionMatches(thisLine, 1, i+1, "/TR", 0, 3)
211                                ) // HTML TABLE
212                        {
213                            startTag("HTMLTABLES");
214                        }
215                        else if (regionMatches(thisLine, 1, i+1, "IMG", 0, 3) OR regionMatches(thisLine, 1, i+1, "STY", 0, 3) OR regionMatches(thisLine, 1, i+1, "/STY", 0, 4)) //IMG or STYLE Tag
216                        // TODO: Do separate syntax highlighting for stuff inside style
217                        {
218                            startTag("HTMLSTYLES");
219                        }
220                        else if (
221                                    regionMatches(thisLine, 1, i+1, "FORM", 0, 4) OR
222                                    regionMatches(thisLine, 1, i+1, "/FORM", 0, 5) OR
223                                    regionMatches(thisLine, 1, i+1, "INPUT", 0, 5) OR
224                                    regionMatches(thisLine, 1, i+1, "/INPUT", 0, 5) OR
225                                    regionMatches(thisLine, 1, i+1, "TEXT", 0, 4) OR
226                                    regionMatches(thisLine, 1, i+1, "/TEXT", 0, 5) OR
227                                    regionMatches(thisLine, 1, i+1, "SELECT", 0, 6) OR
228                                    regionMatches(thisLine, 1, i+1, "/SELECT", 0, 7) OR
229                                    regionMatches(thisLine, 1, i+1, "OPT", 0, 3) OR
230                                    regionMatches(thisLine, 1, i+1, "/OPT", 0, 3)
231                                )
232                        {
233                            startTag("HTMLFORMS");
234                        }
235                        else if (
236                                     regionMatches(thisLine, 1, i+1, "MX:", 0, 3) OR
237                                    regionMatches(thisLine, 1, i+1, "/MX:", 0, 4)
238                                )
239                        {
240                            if (regionMatches(thisLine, 1, i+4, "SCRIPT>", 0, 6)) // MX:SCRIPT TAG
241                            {
242                                startTag("ACTIONSCRIPTTAG");
243                                variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',i+10)) & "&gt;");
244                                i=i+10;
245                                startActionscript();
246                            } else if (regionMatches(thisLine, 1, i+5, "SCRIPT>", 0, 6)) // END MX:SCRIPT TAG
247                            {
248                                endActionscript();
249                                startTag("ACTIONSCRIPTTAG");
250                                variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',i+11)));
251                                i=i+12;
252                                endTag();
253                            } else {
254                                startTag("MXML");
255                                startAttributePos=find(' ',thisLine,i+1); //start finding the next space from current position
256                                endtagPos=find('>
',thisLine,i+1); //start finding the end tag from current position
257                                if (startAttributePos neq 0) {  // start attribute colors
258                                    variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',startAttributePos)));
259                                    i=startAttributePos-1;
260                                    startMXMLTag();
261                                } else {
262                                    if (endtagPos neq 0) { // found >

263                                        variables.buffer.append(thisLine.substring(javacast('int',i+1), javacast('int',endtagPos-1)));
264                                        i=i+endtagPos;
265                                        variables.buffer.append("&gt;");
266                                        endHighlight();
267                                    }
268                                }    
269                            }
270                        } else {
271                            if (variables.isActionscript or variables.isSQL) {
272                                variables.buffer.append("&lt;");
273                            } else {
274                                startTag("HTML");
275                            }
276                        }
277                    }
278                }
279                else if (character EQ '>')
280                {
281                    if (variables.isCommented AND regionMatches(thisLine, 1, i-2, "--", 0, 2))
282                    {
283                        if (regionMatches(thisLine, 1, i-3, "-", 0, 1))
284                        {
285                            endComment("CF");
286                        } else {
287                            endComment("HTML");
288                        }
289                    } else {
290                        if (variables.isCFSETTag) {
291                            endCFSET();
292                        } else if (variables.isActionscript) {
293                            //This is where a CDATA for AS ends
294                            variables.buffer.append("&gt;");
295                        } else if (variables.isSQL) {
296                            variables.buffer.append("&gt;");
297                        } else if (variables.isCFQueryTag) {
298                            endTag();
299                            startSQL();
300                        } else if (variables.isMXML) {
301                            endMXMLTag();
302                        } else {
303                            endTag();
304                        }
305                    }
306                }
307                else if (character EQ '"')
308                {
309                    if (variables.isTag OR variables.isCFScript OR variables.isActionscript)
310                    {
311                        if (NOT variables.isValue) {
312                            startValue();
313                            variables.buffer.append('"');
314                        } else {
315                            variables.buffer.append('"');
316                            endValue();
317                        }
318                    } else {
319                        variables.buffer.append('"');
320                    }
321                }
322                else if (character EQ '{')
323                {
324                    startBind();
325                    variables.buffer.append("{");
326                    endBind();
327                }
328                else if (character EQ '}')
329                {
330                    startBind();
331                    variables.buffer.append("}");
332                    endBind();
333                }
334                else if (character EQ '/')
335                {
336                    if ((variables.isCFScript OR variables.isActionscript) AND regionMatches(thisLine, 1, i+1, "/", 0, 1) AND NOT variables.isCommented)
337                    {
338                        if (variables.isActionscript) {
339                            startOneLineComment("MXMLCOMMENT");
340                            variables.buffer.append("/");
341                        } else {
342                            startOneLineComment("HTMLCOMMENT");
343                            variables.buffer.append("/");
344                        }
345                    }
346                    else if (variables.isCommented)
347                    {
348                        if (regionMatches(thisLine, 1, i-1, "*", 0, 1))
349                        {
350                            endComment("SCRIPT");
351                        } else {
352                            variables.buffer.append("/");
353                        }
354                    } else {
355                        if (regionMatches(thisLine, 1, i+1, "*", 0, 1))
356                        {
357                            startComment("SCRIPT");
358                        } else {
359                            variables.buffer.append("/");
360                        }
361                    }
362                }
363                else if (variables.isSQL AND character EQ '-')
364                {
365                    if (regionMatches(thisLine, 1, i+1, "-", 0, 1) AND NOT variables.isCommented)
366                    {
367                        startOneLineComment("SQLCOMMENT");
368                        variables.buffer.append("-");
369                    } else {
370                        variables.buffer.append("-");
371                    }
372                }
373                else if (variables.isSQL AND character EQ "'" AND NOT variables.isCommented)
374                {
375                    if (NOT variables.isValue) {
376                        startValue();
377                        variables.buffer.append("'");
378                    } else {
379                        variables.buffer.append("'");
380                        endValue();
381                    }
382                }
383
384                // straight up replacements
385                else if (character EQ '\t' OR character EQ '    ')
386                {
387                    variables.buffer.append("&nbsp;&nbsp;&nbsp;&nbsp;");
388                }
389                else if (character EQ ' ')
390                {
391                    variables.buffer.append("&nbsp;");
392                }
393                else if (character EQ '&')
394                {
395                    if (regionMatches(thisLine, 1, i+1, "##", 0, 1)) {
396                        variables.buffer.append("&");
397                    } else {
398                        variables.buffer.append("&amp;");
399                    }
400                } else {
401                    if (not variables.isCommented AND not variables.isValue and (i eq 0 OR NOT listcontainsnocase('a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,@', thisLine.substring(javacast('int',i-1),javacast('int',i))))) {
402                        keywordskip = 0;
403                        // would like this to be much more generic rather than checking "is"
404                        if (variables.isActionscript) {
405                            keywordskip = keywordsearch(thisLine,i,"Actionscript");
406                        } else if (variables.isCFscript or variables.isCFSetTag) {
407                            keywordskip = keywordsearch(thisLine,i,"CFscript");
408                        } else if (variables.isSQL) {
409                            keywordskip = keywordsearch(thisLine,i,"sql");
410                        }
411                        if (keywordskip) {
412                            i = i + keywordskip;
413                        } else {
414                            variables.buffer.append(character.toString());
415                        }
416                    } else {
417                        variables.buffer.append(character.toString());
418                    }
419                }
420            }
421            variables.buffer.append("<br />");
422        </cfscript>
423    </cffunction>
424    <cffunction name="keywordsearch" access="private" hint="This function searches for keywords." output="false">
425        <cfargument name="thisLine" type="any"/>
426        <cfargument name="i" type="numeric"/>
427        <cfargument name="parser" type="string"/>
428        <cfset var keywordmap = getConfig().getKeywordmap()/>
429        <cfset var keyword = listfirst(thisLine.substring(javacast('int',i)),' (')/> <!--- search starting from current position --->
430        <cfset var findkey = StructFindKey(keywordmap[parser], keyword)/>
431        <cfset var keywordtype = ""/>
432        
433        <cfif arraylen(findkey)>
434            <cfset keywordtype = findkey[1].value/>
435            <cfset variables.buffer.append("<span style='" & getStyle(keywordtype) & "'>" & keyword & "</span>")/>
436             <cfreturn keyword.length()-1/>
437        </cfif>
438        <cfreturn 0/>
439    </cffunction>
440    <cffunction name="regionMatches" access="private" hint="This function checks if a regionMatches." output="false">
441        <cfargument name="string1" type="any"/>
442        <cfargument name="caseInsensitive" type="boolean" default="true"/>
443        <cfargument name="startPosition1" type="numeric"/>
444        <cfargument name="string2" type="any"/>
445        <cfargument name="startPosition2" type="numeric"/>
446        <cfargument name="endPosition2" type="numeric"/>
447        <cfreturn arguments.string1.regionMatches(arguments.caseInsensitive, javacast('int',arguments.startPosition1), arguments.string2, javacast('int',arguments.startPosition2), javacast('int',arguments.endPosition2))/>
448    </cffunction>
449    <cffunction name="startHighlight" access="private" hint="" output="false">
450        <cfargument name="element" type="string"/>
451        <cfset variables.spansOpened = variables.spansOpened + 1/>
452        <cfset variables.buffer.append("<span style='" & getStyle(arguments.element) & "'>")/>
453    </cffunction>
454    <cffunction name="endHighlight" access="private" hint="" output="false">
455        <cfargument name="line" type="any"/>
456        <cfset variables.spansClosed = variables.spansClosed + 1/>
457        <cfset variables.buffer.append("</span>")/>
458    </cffunction>
459    <cffunction name="startOneLineComment" access="private" output="false">
460        <cfargument name="type" type="string"/>
461        <cfscript>
462        startHighlight(type);
463        variables.isOneLineComment=true;
464        variables.isCommented=true;
465        
</cfscript>    
466    </cffunction>
467    <cffunction name="endOneLineComment" access="private" output="false">
468        <cfscript>
469        endHighlight();
470        variables.isOneLineComment=false;
471        variables.isCommented=false;
472        
</cfscript>    
473    </cffunction>
474    <cffunction name="startComment" access="private" output="false">
475        <cfargument name="type" type="string"/>
476        <cfscript>
477        if (type  EQ  "CF"{
478            startHighlight("CFCOMMENT");
479            variables.buffer.append("&lt;");
480        } else if (type  EQ  "HTML"{
481            if (variables.isMXML) {
482                startHighlight("MXMLCOMMENT");
483            } else {
484                startHighlight("HTMLCOMMENT");
485            }
486            variables.buffer.append("&lt;");
487        } else {
488            if (variables.isActionscript) {
489                startHighlight("ACTIONSCRIPTCOMMENT");
490            } else if (variables.isSQL) {
491                startHighlight("SQLCOMMENT");
492            } else {
493                startHighlight("CFSCRIPTCOMMENT");
494            }
495            variables.buffer.append("/");
496        }
497        variables.isCommented=true;
498        
</cfscript>
499    </cffunction>
500    <cffunction name="endComment" access="private" output="false">
501        <cfargument name="type" type="string"/>
502        <cfscript>
503        if (type  EQ  "SCRIPT"{
504            variables.buffer.append("/");
505        } else {
506            variables.buffer.append("&gt;");
507        }
508        endHighlight();
509        variables.isCommented=false;
510        
</cfscript>
511    </cffunction>
512    <cffunction name="startTag" access="private" output="false">
513        <cfargument name="type" type="string"/>
514        <cfscript>
515        if NOTT variables.isCommented AND NOT variables.isValue) {
516            if (type  EQ  "CF"{
517                startHighlight("CFTAG");
518            } else if (type  EQ  "HTMLSTYLES"{
519                startHighlight("HTMLSTYLES");
520            } else if (type  EQ  "HTMLTABLES"{
521                startHighlight("HTMLTABLES");
522            } else if (type  EQ  "HTMLFORMS"{
523                startHighlight("HTMLFORMS");
524            } else if (type EQ "MXML"{
525                startHighlight("MXML");
526            } else if (type EQ "ACTIONSCRIPTTAG"{
527                startHighlight("ACTIONSCRIPTTAG");
528            } else { // type is HTML
529
                startHighlight("HTML");
530            }
531            variables.isTag=true;
532        }
533        variables.buffer.append("&lt;");
534        
</cfscript>
535    </cffunction>
536    <cffunction name="endTag" access="private" output="false">
537        <cfscript>
538        variables.buffer.append("&gt;");
539        if NOTT variables.isCommented AND NOT variables.isValue) {
540            endHighlight();
541            variables.isTag=false;
542        }
543        
</cfscript>
544    </cffunction>
545    <cffunction name="startValue" access="private" output="false">
546        <cfscript>
547        if NOTT variables.isCommented) {
548            if (variables.isCFSETTag OR variables.isCFScript) {
549                startHighlight("CFSCRIPTVALUE");
550            } else if (variables.isActionscript) {
551                startHighlight("ACTIONSCRIPTVALUE");
552            } else if (variables.isMXML) {
553                startHighlight("MXMLVALUE");
554            } else if (variables.isSQL) {
555                startHighlight("SQLVALUE");
556            } else {
557                startHighlight("VALUE");
558            }
559            variables.isValue=true;
560        }
561        
</cfscript>
562    </cffunction>
563    <cffunction name="endValue" access="private" output="false">
564        <cfscript>
565        if NOTT variables.isCommented) {
566            endHighlight();
567            variables.isValue=false;
568        }
569        
</cfscript>
570    </cffunction>
571    <cffunction name="startBind" access="private" output="false">
572        <cfscript>
573        if NOTT variables.isCommented) {
574            startHighlight("BIND");
575        }
576        
</cfscript>
577    </cffunction>
578    <cffunction name="endBind" access="private" output="false">
579        <cfscript>
580        if NOTT variables.isCommented) {
581            endHighlight();
582        }
583        
</cfscript>
584    </cffunction>
585    <cffunction name="startCFSET" access="private" output="false">
586        <cfscript>
587        if NOTT variables.isCommented) {
588            startHighlight("CFSET");
589            variables.isCFSETTag=true;
590        }
591        
</cfscript>
592    </cffunction>
593    <cffunction name="endCFSET" access="private" output="false">
594        <cfscript>
595        if NOTT variables.isCommented) {
596            endHighlight();
597            variables.buffer.append("&gt;");
598            endHighlight();
599            variables.isCFSETTag=false;
600        } else {
601            variables.buffer.append("&gt;");
602        }
603        
</cfscript>
604    </cffunction>
605    <cffunction name="startMXMLTag" access="private" output="false">
606        <cfscript>
607        if NOTT variables.isCommented) {
608            startHighlight("MXMLATTRIBUTES");
609            // TODO: Add in MXML Value colors.
610
            // setStyle("VALUE","color:##900");
611
            variables.isMXML=true;
612        }
613        
</cfscript>
614    </cffunction>
615    <cffunction name="endMXMLTag" access="private" output="false">
616        <cfscript>
617        if NOTT variables.isCommented) {
618            endHighlight();
619            variables.buffer.append("&gt;");
620            endHighlight();
621            // TODO: Add in MXML Value colors.
622
            // setStyle("VALUE","color:##0000CC");
623
            variables.isMXML=false;
624        } else {
625            variables.buffer.append("&gt;");
626        }
627        
</cfscript>
628    </cffunction>
629    <cffunction name="startCFScript" access="private" output="false">
630        <cfscript>
631        if NOTT variables.isCommented) {
632            endHighlight();
633            startHighlight("CFSCRIPT");
634            variables.isCFScript=true;
635        }
636        
</cfscript>
637    </cffunction>
638    <cffunction name="endCFScript" access="private" output="false">
639        <cfscript>
640        if NOTT variables.isCommented) {
641            endHighlight();
642            variables.isCFScript=false;
643        }
644        
</cfscript>
645    </cffunction>
646    <cffunction name="startActionscript" access="private" output="false">
647        <cfscript>
648        if NOTT variables.isCommented) {
649            endHighlight();
650            startHighlight("ACTIONSCRIPT");
651            variables.isActionscript=true;
652        }
653        
</cfscript>
654    </cffunction>
655    <cffunction name="endActionscript" access="private" output="false">
656        <cfscript>
657        if NOTT variables.isCommented) {
658            variables.isActionscript=false;
659        }
660        
</cfscript>
661    </cffunction>
662    <cffunction name="startSQL" access="private" output="false">
663        <cfscript>
664        if NOTT variables.isCommented) {
665            variables.isSQL=true;
666        }
667        
</cfscript>
668    </cffunction>
669    <cffunction name="endSQL" access="private" output="false">
670        <cfscript>
671        if NOTT variables.isCommented) {
672            variables.isSQL=false;
673        }
674        
</cfscript>
675    </cffunction>
676    
677    <!--- configuration methods --->
678    <cffunction name="setConfig" access="public" hint="This sets the coldfish configuration object for the parser to use." output="false">
679        <cfargument name="config" type="any"/>
680        <cfset variables.coldfishconfig = config/>
681    </cffunction>
682    <cffunction name="getConfig" access="public" hint="This sets the coldfish configuration object for the parser to use." output="false">
683        <cfargument name="config" type="any"/>
684        <cfreturn variables.coldfishconfig/>
685    </cffunction>
686    <cffunction name="getStyle" access="private" hint="This function can be used to get the style used in conjunction with a type of language element." output="false">
687        <cfargument name="element" type="string"/>
688        <cfreturn getConfig().getStyle(element)/>
689    </cffunction>
690    <cffunction name="getInitialParser" access="private" hint="You can set the initial parser state with this.  This is helpful for scripts that make initial parsing impossible (ie. Script, Actionscript)" output="false">
691        <cfreturn getConfig().getInitialParser()/>
692    </cffunction>
693    <cffunction name="getKeywordmap" access="private" hint="You can set the keywordmap with this." output="false">
694        <cfreturn getConfig().getKeywordMap()/>
695    </cffunction>
696</cfcomponent>

I'd like to extend a special thanks to Ray Camden & Jason Delmore for their prompt replies and expeditious changes ... Much Appreciated.

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Florida Search Engine Optimization L.L.C.
Search Engine Optimization Specialist || Web Designer || Web Developer || Edward J Beckett ||
Search Engine Optimization Company  || SEO Services || Internet Marketing Company || Search Engine Optimization Expert || Florida Search Engine Optimization LLC
Florida Search Engine Optimization || Search Engine Optimization || SEO Services || Florida SEO Blog
Florida Search Engine Optimization
Search Engine Optimization
SEO Services
Florida SEO Blog
May-17-2012
10:29 PM EST