Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/groovy
File: index.html
<!doctype html>
[0] Fix | Delete
[1] Fix | Delete
<title>CodeMirror: Groovy mode</title>
[2] Fix | Delete
<meta charset="utf-8"/>
[3] Fix | Delete
<link rel=stylesheet href="../../doc/docs.css">
[4] Fix | Delete
[5] Fix | Delete
<link rel="stylesheet" href="../../lib/codemirror.css">
[6] Fix | Delete
<script src="../../lib/codemirror.js"></script>
[7] Fix | Delete
<script src="../../addon/edit/matchbrackets.js"></script>
[8] Fix | Delete
<script src="groovy.js"></script>
[9] Fix | Delete
<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
[10] Fix | Delete
<div id=nav>
[11] Fix | Delete
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
[12] Fix | Delete
[13] Fix | Delete
<ul>
[14] Fix | Delete
<li><a href="../../index.html">Home</a>
[15] Fix | Delete
<li><a href="../../doc/manual.html">Manual</a>
[16] Fix | Delete
<li><a href="https://github.com/codemirror/codemirror">Code</a>
[17] Fix | Delete
</ul>
[18] Fix | Delete
<ul>
[19] Fix | Delete
<li><a href="../index.html">Language modes</a>
[20] Fix | Delete
<li><a class=active href="#">Groovy</a>
[21] Fix | Delete
</ul>
[22] Fix | Delete
</div>
[23] Fix | Delete
[24] Fix | Delete
<article>
[25] Fix | Delete
<h2>Groovy mode</h2>
[26] Fix | Delete
<form><textarea id="code" name="code">
[27] Fix | Delete
//Pattern for groovy script
[28] Fix | Delete
def p = ~/.*\.groovy/
[29] Fix | Delete
new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
[30] Fix | Delete
// imports list
[31] Fix | Delete
def imports = []
[32] Fix | Delete
f.eachLine {
[33] Fix | Delete
// condition to detect an import instruction
[34] Fix | Delete
ln -> if ( ln =~ '^import .*' ) {
[35] Fix | Delete
imports << "${ln - 'import '}"
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
// print thmen
[39] Fix | Delete
if ( ! imports.empty ) {
[40] Fix | Delete
println f
[41] Fix | Delete
imports.each{ println " $it" }
[42] Fix | Delete
}
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/* Coin changer demo code from http://groovy.codehaus.org */
[46] Fix | Delete
[47] Fix | Delete
enum UsCoin {
[48] Fix | Delete
quarter(25), dime(10), nickel(5), penny(1)
[49] Fix | Delete
UsCoin(v) { value = v }
[50] Fix | Delete
final value
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
enum OzzieCoin {
[54] Fix | Delete
fifty(50), twenty(20), ten(10), five(5)
[55] Fix | Delete
OzzieCoin(v) { value = v }
[56] Fix | Delete
final value
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
def plural(word, count) {
[60] Fix | Delete
if (count == 1) return word
[61] Fix | Delete
word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
def change(currency, amount) {
[65] Fix | Delete
currency.values().inject([]){ list, coin ->
[66] Fix | Delete
int count = amount / coin.value
[67] Fix | Delete
amount = amount % coin.value
[68] Fix | Delete
list += "$count ${plural(coin.toString(), count)}"
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
</textarea></form>
[72] Fix | Delete
[73] Fix | Delete
<script>
[74] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
[75] Fix | Delete
lineNumbers: true,
[76] Fix | Delete
matchBrackets: true,
[77] Fix | Delete
mode: "text/x-groovy"
[78] Fix | Delete
});
[79] Fix | Delete
</script>
[80] Fix | Delete
[81] Fix | Delete
<p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
[82] Fix | Delete
</article>
[83] Fix | Delete
[84] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function