Converts common CFML to cfscript using Java.
Java ColdFusion Ruby Shell Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
doc
src fixes StringIndexOutOfBoundsException handling whitespace inside cfsc… Nov 15, 2013
.gitignore
pom.xml
readme.md

readme.md

CFScriptify

Converts CFML to cfscript using Java. (video demo)

Usage

Assuming you have maven 3 (standard on mac os 10.7, 10.8)

mvn --version
mvn -q compile assembly:single
bin/test.rb
bin/run.sh < src/test/input/01.cfm

Limitations

  • Tags: Only the most common 20% of tags are supported (See Appendix A).
  • Operators: Mixed-case, eg. CoNtAiNs, is legal in CFML, but not supported here.

Whitespace Output

  • Line Endings: LF (but CR and CRLF are acceptable as input)
  • Indentation: Tabs, but I'd welcome a pull request for spaces

Sublime Text 2 Plugin

Nothing polished yet, but here's a starting point:

  1. Make sure the tests (described above) pass
  2. Tools -> New Plugin ..
  3. Paste in src/main/sublime/cfscriptify.py
  4. Edit cfs_path() to return the path to run.sh
  5. Select some CFML
  6. Try your new plugin in sublime's python shell (ctrl-backtick)
    • view.run_command("cfscriptify")
  7. If it works, bind a key, eg.
    • { "keys": ["ctrl+alt+super+s"], "command": "cfscriptify" }

References

Appendix A: Supported CFML Tags

Supported (24)

cfabort cfbreak cfcatch cfcomponent cfcontinue cfdefaultcase cfdump cfelse cfelseif cffinally cfif cfinclude cflocation cflock cflog cfparam cfrethrow cfreturn cfscript cfset cfsilent cfswitch cfthrow cftry

Partially supported (4)

cfargument is supported except that hint and displayName attributes are discarded, because the syntax for those attributes is awkward in cfscript. I'd welcome a pull request.

cfcase is supported for single values. List values are not supported yet.

cffunction is supported for the following attributes: name, access, and returnType. The output attribute is ignored, and all other attributes will cause an error.

cfloop is supported for list, array, and from/to/step. Support is planned for loop over query, structure, and condition. Loop over date range is rare, but wouldn't be too difficult to implement. Finally, loop over file is rare and has no convenient cfscript equivalent.

No Plans to Support (119)

These tags either do not have convenient cfscript equivalents, have complicated varients (eg. cffile), or are too rare to be worth the trouble. Pull requests, however, are welcome.

cfapplication cfassociate cfajaximport cfajaxproxy cfapplet cfcache cfcalendar cfchart cfchartdata cfchartseries cfcontent cfcol cfcollection cfcookie cfdbinfo cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cferror cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask cfexecute cfexit cffeed cffile cffileupload cfflush cfform cfformgroup cfformitem cfftp cfgrid cfgridcolumn cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfimage cfimap cfimport cfindex cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflogin cfloginuser cflogout cfmail cfmailparam cfmailpart cfmap cfmapitem cfmediaplayer cfmenu cfmenuitem cfmessagebox cfNTauthenticate cfobject cfobjectcache cfoutput cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult cfprogressbar cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfsavecontent cfschedule cfsearch cfselect cfsetting cfsharepoint cfslider cfspreadsheet cfsprydataset cfstoredproc cftable cftextarea cfthread cftimer cftooltip cftrace cftransaction cftree cftreeitem cfupdate cfwddx cfwindow cfxml cfzip cfzipparam