CMIContent Marketing InstituteContent directory

News · General · Archive

CodeMirror: Groovy mode

Home News

.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}

CodeMirror

Home Manual Code

Language modes Groovy

Groovy mode

//Pattern for groovy script def p = ~/.*\.groovy/ new File( 'd:\scripts' ).eachFileMatch(p) {f -> // imports list def imports = [] f.eachLine { // condition to detect an import instruction ln -> if ( ln =~ '^import .*' ) { imports int count = amount / coin.value amount = amount % coin.value list += "$count ${plural(coin.toString(), count)}" } }

var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, matchBrackets: true, mode: "text/x-groovy" });

MIME types defined: text/x-groovy

More in Archive · More in General · More in News