- From: Xiang-Jun Lu <lux@ncifcrf.gov>
- Date: Wed, 15 Sep 2004 12:00:53 -0400 (EDT)
- To: html-tidy@w3.org
- cc: "Larry W. Virden" <lvirden@cas.org>
Dear Larry:
Thank you so much for your quick response to my question regarding
ColdFusion and Tidy.
I tested your configuration file against a simple ColdFusion script
named "udf.cfm", as follows:
--------------------------------------------------------------------------------
<cfscript>
/* takes off leading zero from numeric nsc numbers: RegExp will be better */
function NscNumberFormat(nsc) {
formatedNsc = nsc;
if (IsNumeric(nsc)) {
while (Find("0", formatedNsc) eq "1") {
formatedNsc = Mid(formatedNsc, 2, Len(formatedNsc) - 1);
}
}
return formatedNsc;
}
</cfscript>
--------------------------------------------------------------------------------
The configuration file named "my_config" is as follows:
--------------------------------------------------------------------------------
# Tidy configuration file for handling ColdFusion tags.
# Based on the file supplied by Larry W. Virden <mailto:lvirden@cas.org>
# ???The tag names have to be changed to lower case???
# string: declare new block-level tags
new-blocklevel-tags: cfform, cfgrid, cfhttp, cfif, cflock, cfloop, cfoutput, cfquery, cfreport, cfscript, cfselect, cfswitch, cfcase, cfdefaultcase, cftable, cftransaction, cftree, cftry, cfcatch
# string: declare new empty inline tags
new-empty-tags:
# string: declare new non-empty inline tags
new-inline-tags: cfabort, cfapplet, cfapplication, cfassociate, cfauthenticate, cfbreak, cfcache, cfcol, cfcollection, cfcontent, cfcookie, cfdirectory, cfelse, cfelseif, cferror, cfexit, cffile, cfftp, cfgridcolumn, cfgridrow, cfgridupdate, cfheader, cfhtmlhead, cfhttpparam, cfinclude, cfindex, cfinput, cfinsert, cfldap, cflocation, cfmail, cfmodule, cfobject, cfparam, cfpop, cfprocparam, cfprocresult, cfregistry, cfschedule, cfsearch, cfset, cfsetting, cfslider, cfstoredproc, cftextinput, cfthrow, cftreeitem, cfupdate, cfwddx
--------------------------------------------------------------------------------
Note that I have to convert the CF tag names to lower case, otherwise,
"tidy" gives *errors* for the above "udf.cfm" file.
I run tidy (for Windows released on 1st August 2004) as follows:
tidy -i -c -config my_config -o udf_tidy.cfm udf.cfm
The output file "udf_tidy.cfm" is:
--------------------------------------------------------------------------------
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 1st August 2004), see www.w3.org">
<title></title>
</head>
<body>
<cfscript>/* takes off leading zero from numeric nsc numbers:
RegExp will be better */ function NscNumberFormat(nsc) {
formatedNsc = nsc; if (IsNumeric(nsc)) { while (Find("0",
formatedNsc) eq "1") { formatedNsc = Mid(formatedNsc, 2,
Len(formatedNsc) - 1); } } return formatedNsc; }</cfscript>
</body>
</html>
--------------------------------------------------------------------------------
Note that the cfscript block is now in a single line, also,
<html>/<head>/<body> tags were added --- it is no longer a pure ColdFusion
script that can be included directly into other .cfm files.
Now my question is: it is possible for tidy to pretty-print *only*
ColdFusion part (the <cfscript> block tag) without introducing HTML
house-keeping tags? Or when CF tags are combined with HTML as is often the
case, can the CF tags also be pretty-printed (instead of put into one
line) by tidy?
Many thanks for your help.
Xiang-Jun
--
Xiang-Jun Lu, Ph.D. | Laboratory of Computational Technologies
Email: lux@ncifcrf.gov | NCI-FCRDC, SAIC Frederick (Contractor)
Tel: (301) 846-5490 | P.O. Box B (Bldg. 1052, Rm. 238)
Fax: (301) 846-6978 | Frederick, Maryland 21702-1201
Received on Wednesday, 15 September 2004 16:01:42 UTC