diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index b0198238..a4848d50 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -169,13 +169,44 @@ function loadDoc(name, callback) { }); } +function saveDoc(name, callback) { + var doc = fileCache[name] || name; + if (!doc || !doc.session) + return callback("Unknown document: " + name); + + var path = doc.path; + var parts = path.split("/"); + if (parts[0] == "docs") + path = "demo/kitchen-sink/" + path; + else if (parts[0] == "ace") + path = "lib/" + path; + + upload(path, doc.session.getValue(), callback); +} + +function upload(url, data, callback) { + url = net.qualifyURL(url); + if (!/https?:/.test(url)) + return callback(new Error("Unsupported url scheme")); + var xhr = new XMLHttpRequest(); + xhr.open("PUT", url, true); + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + callback(!/^2../.test(xhr.status)); + } + }; + xhr.send(data); +}; + + module.exports = { fileCache: fileCache, docs: sort(prepareDocList(docs)), ownSource: prepareDocList(ownSource), hugeDocs: prepareDocList(hugeDocs), initDoc: initDoc, - loadDoc: loadDoc + loadDoc: loadDoc, + saveDoc: saveDoc, }; module.exports.all = { "Mode Examples": module.exports.docs, diff --git a/demo/kitchen-sink/docs/abc.abc b/demo/kitchen-sink/docs/abc.abc new file mode 100644 index 00000000..d8ac326e --- /dev/null +++ b/demo/kitchen-sink/docs/abc.abc @@ -0,0 +1,171 @@ +%abc-2.1 +H:This file contains some example English tunes +% note that the comments (like this one) are to highlight usages +% and would not normally be included in such detail +O:England % the origin of all tunes is England + +X:1 % tune no 1 +T:Dusty Miller, The % title +T:Binny's Jig % an alternative title +C:Trad. % traditional +R:DH % double hornpipe +M:3/4 % meter +K:G % key +B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:| +Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:| +BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:| +W:Hey, the dusty miller, and his dusty coat; +W:He will win a shilling, or he spend a groat. +W:Dusty was the coat, dusty was the colour; +W:Dusty was the kiss, that I got frae the miller. + +X:2 +T:Old Sir Simon the King +C:Trad. +S:Offord MSS % from Offord manuscript +N:see also Playford % reference note +M:9/8 +R:SJ % slip jig +N:originally in C % transcription note +K:G +D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:| +D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score +M:12/8 % change of meter +[2 E2E EFE E2E EFG|\ % no line-break in score +M:9/8 % change of meter +A2G F2E D2|] + +X:3 +T:William and Nancy +T:New Mown Hay +T:Legacy, The +C:Trad. +O:England; Gloucs; Bledington % place of origin +B:Sussex Tune Book % can be found in these books +B:Mally's Cotswold Morris vol.1 2 +D:Morris On % can be heard on this record +P:(AB)2(AC)2A % play the parts in this order +M:6/8 +K:G +[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| +[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c| + "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| +% changes of meter, using inline fields +[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\ + "C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c| + "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| + +X:4 +T:South Downs Jig +R:jig +S:Robert Harbron +M:6/8 +L:1/8 +K:G +|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d | +dcA G3 | EFG AFE | DEF GAB | cAF G2 :| +B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 | +[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |] + +X:5 +T:Atholl Brose +% in this example, which reproduces Highland Bagpipe gracing, +% the large number of grace notes mean that it is more convenient to be specific about +% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them +I:linebreak $ +K:D +{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| +{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d| +{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| +{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$ +{g}ce {ag}a>e {gf}g>e| +{g}ce {ag}a2 {GdG}a>d| +{g}ce {ag}a>e {gf}g>f| +{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B| +{g}ce {ag}a>e {gf}g>e| +{g}ce {ag}a2 {GdG}ad| +{g}c<{GdG}e {gf}ga {f}g>e {g}f>d| +{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|] + +X:6 +T:Untitled Reel +C:Trad. +K:D +eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\ +ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:| +K:G +AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:| + +X:7 +T:Kitchen Girl +C:Trad. +K:D +[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg| +a4 g4|efed cdef|g2d2 efed|c2A2 A4:| +K:G +ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB| +ABAG EGAB|cBAc BAG2|A4 A4:| + +%abc-2.1 +%%pagewidth 21cm +%%pageheight 29.7cm +%%topspace 0.5cm +%%topmargin 1cm +%%botmargin 0cm +%%leftmargin 1cm +%%rightmargin 1cm +%%titlespace 0cm +%%titlefont Times-Bold 32 +%%subtitlefont Times-Bold 24 +%%composerfont Times 16 +%%vocalfont Times-Roman 14 +%%staffsep 60pt +%%sysstaffsep 20pt +%%musicspace 1cm +%%vocalspace 5pt +%%measurenb 0 +%%barsperstaff 5 +%%scale 0.7 +X: 1 +T: Canzonetta a tre voci +C: Claudio Monteverdi (1567-1643) +M: C +L: 1/4 +Q: "Andante mosso" 1/4 = 110 +%%score [1 2 3] +V: 1 clef=treble name="Soprano"sname="A" +V: 2 clef=treble name="Alto" sname="T" +V: 3 clef=bass middle=d name="Tenor" sname="B" +%%MIDI program 1 75 % recorder +%%MIDI program 2 75 +%%MIDI program 3 75 +K: Eb +% 1 - 4 +[V: 1] |:z4 |z4 |f2ec |_ddcc | +w: Son que-sti~i cre-spi cri-ni~e +w: Que-sti son gli~oc-chi che mi- +[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA | +w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e +w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi- +[V: 3] |:z4 |f2ec|_ddcf |(B/c/_d/e/)ff| +w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il +w: Que-sti son~gli oc-chi che mi-ran - - - - do +% 5 - 9 +[V: 1] cAB2 |cAAA |c3B|G2!fermata!Gz ::e4| +w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, +w: ran-do fi-so, tut-to re-stai con-qui-so. +[V: 2] AAG2 |AFFF |A3F|=E2!fermata!Ez::c4| +w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, +w: ran-do fi-so tut-to re-stai con-qui-so. +[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4| +w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh, +w: fi - - - so tut-to re-stai con-qui-so. +% 10 - 15 +[V: 1] f_dec |B2c2|zAGF |\ +w: dim-me-lo ben mi-o, che que-sto\ +=EFG2 |1F2z2:|2F8|] % more notes +w: sol de-si-o_. % more lyrics +[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|] +w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_. +[V: 3] _dBc>d|e2AF|=EFc_d|c4 |1F2z2:|2F8|] +w: dim-me-lo ben mi-o, che que-sto sol de-si-o_. \ No newline at end of file diff --git a/demo/kitchen-sink/docs/ruby.rb b/demo/kitchen-sink/docs/ruby.rb index c4d73d19..386fbb86 100644 --- a/demo/kitchen-sink/docs/ruby.rb +++ b/demo/kitchen-sink/docs/ruby.rb @@ -20,7 +20,7 @@ class Range end end -{:id => 34, :key => "value"} +{:id => ?", :key => "value"} herDocs = [<<'FOO', <> See all themes

Setting the Programming Language Mode

By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:

-
editor.getSession().setMode("ace/mode/javascript");
-                            
+
editor.getSession().setMode("ace/mode/javascript");