diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 14ffea23..6c691238 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -301,7 +301,7 @@ var buildAce = function(options) { noconflict: false, suffix: null, name: "ace", - modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/), + modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/), themes: jsFileList("lib/ace/theme"), extensions: jsFileList("lib/ace/ext"), workers: workers("lib/ace/mode"), @@ -522,7 +522,7 @@ function generateThemesModule(themes) { '\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '), ';\n\n});' ].join(''); - fs.writeFileSync('./lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8'); + fs.writeFileSync(__dirname + '/lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8'); } function inlineTextModules(text) { diff --git a/build b/build index 8f2423d1..995de31e 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 8f2423d10a7cc5680dcdb42a2dd57d9b192e3b34 +Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253 diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 9fdf6a64..3abdf664 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -66,95 +66,19 @@ function makeHuge(txt) { } var docs = { - "docs/javascript.js": "JavaScript", - "docs/AsciiDoc.asciidoc": "AsciiDoc", - "docs/clojure.clj": "Clojure", - "docs/coffeescript.coffee": "CoffeeScript", - "docs/coldfusion.cfm": "ColdFusion", - "docs/cpp.cpp": "C/C++", - "docs/csharp.cs": "C#", - "docs/css.css": "CSS", - "docs/curly.curly": "Curly", - "docs/dart.dart": "Dart", - "docs/diff.diff": "Diff", - "docs/dot.dot": "Dot", - "docs/freemarker.ftl" : "FreeMarker", - "docs/glsl.glsl": "Glsl", - "docs/golang.go": "Go", - "docs/groovy.groovy": "Groovy", - "docs/haml.haml": "Haml", - "docs/Haxe.hx": "haXe", - "docs/html.html": "HTML", - "docs/html_ruby.erb": "HTML (Ruby)", - "docs/jade.jade": "Jade", - "docs/java.java": "Java", - "docs/jsp.jsp": "JSP", - "docs/json.json": "JSON", - "docs/jsx.jsx": "JSX", + "docs/javascript.js": {order: 1, name: "JavaScript"}, + "docs/latex.tex": {name: "LaTeX", wrapped: true}, - "docs/less.less": "LESS", - "docs/lisp.lisp": "Lisp", - "docs/lsl.lsl": "LSL", - "docs/scheme.scm": "Scheme", - "docs/livescript.ls": "LiveScript", - "docs/liquid.liquid": "Liquid", - "docs/logiql.logic": "LogiQL", - "docs/lua.lua": "Lua", - "docs/lucene.lucene": "Lucene", - "docs/luapage.lp": "LuaPage", - "docs/Makefile": "Makefile", "docs/markdown.md": {name: "Markdown", wrapped: true}, "docs/mushcode.mc": {name: "MUSHCode", wrapped: true}, - "docs/objectivec.m": {name: "Objective-C"}, - "docs/ocaml.ml": "OCaml", - "docs/OpenSCAD.scad": "OpenSCAD", - "docs/pascal.pas": "Pascal", - "docs/perl.pl": "Perl", "docs/pgsql.pgsql": {name: "pgSQL", wrapped: true}, - "docs/php.php": "PHP", "docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true}, - "docs/powershell.ps1": "Powershell", - "docs/properties.properties": "Properties", - "docs/python.py": "Python", - "docs/r.r": "R", - "docs/rdoc.Rd": "RDoc", - "docs/rhtml.rhtml": "RHTML", - "docs/ruby.rb": "Ruby", - "docs/abap.abap": "SAP - ABAP", - "docs/scala.scala": "Scala", - "docs/scss.scss": "SCSS", - "docs/sass.sass": "SASS", - "docs/sh.sh": "SH", - "docs/space.space": "Space", - "docs/stylus.styl": "Stylus", "docs/sql.sql": {name: "SQL", wrapped: true}, - "docs/svg.svg": "SVG", - "docs/tcl.tcl": "Tcl", - "docs/tex.tex": "Tex", - "docs/textile.textile": {name: "Textile", wrapped: true}, - "docs/snippets.snippets": "snippets", - "docs/toml.toml": "TOML", - "docs/typescript.ts": "Typescript", - "docs/vbscript.vbs": "VBScript", - "docs/velocity.vm": "Velocity", - "docs/xml.xml": "XML", - "docs/xquery.xq": "XQuery", - "docs/yaml.yaml": "YAML", - "docs/c9search.c9search_results": "C9 Search Results", - "docs/actionscript.as": "ActionScript", - "docs/assembly_x86.asm": "Assembly_x86", - "docs/autohotkey.ahk": "AutoHotKey", - "docs/batchfile.bat": "BatchFile", - "docs/erlang.erl": "Erlang", - "docs/forth.frt": "Forth", - "docs/haskell.hs": "Haskell", - "docs/julia.js": "Julia", - "docs/prolog.plg": "Prolog", - "docs/rust.rs": "Rust", - "docs/twig.twig": "Twig", - "docs/Nix.nix": "Nix", - "docs/protobuf.proto": "Protobuf" + "docs/textile.textile": {name: "Textile", wrapped: true}, + + "docs/c9search.c9search_results": "C9 Search Results", + "docs/Nix.nix": "Nix" }; var ownSource = { @@ -166,6 +90,23 @@ var hugeDocs = { "build/src-min/ace.js": "" }; +modelist.modes.forEach(function(m) { + var ext = m.extensions.split("|")[0]; + if (ext[0] === "^") { + path = ext.substr(1); + } else { + var path = m.name + "." + ext + } + path = "docs/" + path; + if (!docs[path]) { + docs[path] = {name: m.caption}; + } else if (typeof docs[path] == "object" && !docs[path].name) { + docs[path].name = m.caption; + } +}) + + + if (window.require && window.require.s) try { for (var path in window.require.s.contexts._.defined) { if (path.indexOf("!") != -1) @@ -176,6 +117,13 @@ if (window.require && window.require.s) try { } } catch(e) {} +function sort(list) { + return list.sort(function(a, b) { + var cmp = (b.order || 0) - (a.order || 0); + return cmp || a.name && a.name.localeCompare(b.name); + }) +} + function prepareDocList(docs) { var list = []; for (var path in docs) { @@ -219,7 +167,7 @@ function loadDoc(name, callback) { module.exports = { fileCache: fileCache, - docs: prepareDocList(docs), + docs: sort(prepareDocList(docs)), ownSource: prepareDocList(ownSource), hugeDocs: prepareDocList(hugeDocs), initDoc: initDoc, diff --git a/demo/kitchen-sink/docs/ada.ada b/demo/kitchen-sink/docs/ada.ada new file mode 100644 index 00000000..90e027f0 --- /dev/null +++ b/demo/kitchen-sink/docs/ada.ada @@ -0,0 +1,5 @@ +with Ada.Text_IO; use Ada.Text_IO; +procedure Hello is +begin + Put_Line("Hello, world!"); +end Hello; \ No newline at end of file diff --git a/demo/kitchen-sink/docs/cpp.cpp b/demo/kitchen-sink/docs/c_cpp.cpp similarity index 100% rename from demo/kitchen-sink/docs/cpp.cpp rename to demo/kitchen-sink/docs/c_cpp.cpp diff --git a/demo/kitchen-sink/docs/cobol.CBL b/demo/kitchen-sink/docs/cobol.CBL new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/cobol.CBL @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/coffeescript.coffee b/demo/kitchen-sink/docs/coffee.coffee similarity index 100% rename from demo/kitchen-sink/docs/coffeescript.coffee rename to demo/kitchen-sink/docs/coffee.coffee diff --git a/demo/kitchen-sink/docs/d.d b/demo/kitchen-sink/docs/d.d new file mode 100644 index 00000000..57069067 --- /dev/null +++ b/demo/kitchen-sink/docs/d.d @@ -0,0 +1,14 @@ +#!/usr/bin/env rdmd +// Computes average line length for standard input. +import std.stdio; + +void main() { + ulong lines = 0; + double sumLength = 0; + foreach (line; stdin.byLine()) { + ++lines; + sumLength += line.length; + } + writeln("Average line length: ", + lines ? sumLength / lines : 0); +} \ No newline at end of file diff --git a/demo/kitchen-sink/docs/ejs.ejs b/demo/kitchen-sink/docs/ejs.ejs new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/ejs.ejs @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/freemarker.ftl b/demo/kitchen-sink/docs/ftl.ftl similarity index 100% rename from demo/kitchen-sink/docs/freemarker.ftl rename to demo/kitchen-sink/docs/ftl.ftl diff --git a/demo/kitchen-sink/docs/handlebars.hbs b/demo/kitchen-sink/docs/handlebars.hbs new file mode 100644 index 00000000..1cdf786e --- /dev/null +++ b/demo/kitchen-sink/docs/handlebars.hbs @@ -0,0 +1,8 @@ +{{!-- Ace + :-}} --}} + +
+ {{#each comments}} +

{{title}}

+
{{body}}
+ {{/each}} +
diff --git a/demo/kitchen-sink/docs/ini.ini b/demo/kitchen-sink/docs/ini.ini new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/ini.ini @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/jsoniq.jq b/demo/kitchen-sink/docs/jsoniq.jq new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/jsoniq.jq @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/matlab.matlab b/demo/kitchen-sink/docs/matlab.matlab new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/matlab.matlab @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/mysql.mysql b/demo/kitchen-sink/docs/mysql.mysql new file mode 100644 index 00000000..30404ce4 --- /dev/null +++ b/demo/kitchen-sink/docs/mysql.mysql @@ -0,0 +1 @@ +TODO \ No newline at end of file diff --git a/demo/kitchen-sink/docs/OpenSCAD.scad b/demo/kitchen-sink/docs/scad.scad similarity index 100% rename from demo/kitchen-sink/docs/OpenSCAD.scad rename to demo/kitchen-sink/docs/scad.scad diff --git a/demo/kitchen-sink/docs/soy_template.soy b/demo/kitchen-sink/docs/soy_template.soy new file mode 100644 index 00000000..3a9e3436 --- /dev/null +++ b/demo/kitchen-sink/docs/soy_template.soy @@ -0,0 +1,46 @@ +/** + * Greets a person using "Hello" by default. + * @param name The name of the person. + * @param? greetingWord Optional greeting word to use instead of "Hello". + */ +{template .helloName #eee} + {if not $greetingWord} + Hello {$name}! + {else} + {$greetingWord} {$name}! + {/if} +{/template} + +/** + * Greets a person and optionally a list of other people. + * @param name The name of the person. + * @param additionalNames The additional names to greet. May be an empty list. + */ +{template .helloNames} + // Greet the person. + {call .helloName data="all" /}
+ // Greet the additional people. + {foreach $additionalName in $additionalNames} + {call .helloName} + {param name: $additionalName /} + {/call} + {if not isLast($additionalName)} +
// break after every line except the last + {/if} + {ifempty} + No additional people to greet. + {/foreach} +{/template} + + +{/foreach} +{if length($items) > 5} +{msg desc="Says hello to the user."} + + +{namespace ns autoescape="contextual"} + +/** Example. */ +{template .example} + foo is {$ij.foo} +{/template} \ No newline at end of file diff --git a/demo/kitchen-sink/docs/verilog.v b/demo/kitchen-sink/docs/verilog.v new file mode 100644 index 00000000..b1f79265 --- /dev/null +++ b/demo/kitchen-sink/docs/verilog.v @@ -0,0 +1,12 @@ +always @(negedge reset or posedge clk) begin + if (reset == 0) begin + d_out <= 16'h0000; + d_out_mem[resetcount] <= d_out; + laststoredvalue <= d_out; + end else begin + d_out <= d_out + 1'b1; + end +end + +always @(bufreadaddr) + bufreadval = d_out_mem[bufreadaddr]; \ No newline at end of file diff --git a/doc/site/js/main.js b/doc/site/js/main.js index ed9fbff4..7e564fbf 100644 --- a/doc/site/js/main.js +++ b/doc/site/js/main.js @@ -6,10 +6,13 @@ $(function() { editor.container.style.opacity = ""; embedded_editor = ace.edit("embedded_ace_code"); embedded_editor.container.style.opacity = ""; - editor.session.setMode("ace/mode/javascript"); - editor.session.setMode("ace/mode/javascript"); + editor.session.setMode("ace/mode/javascript"); embedded_editor.session.setMode("ace/mode/html"); + editor.setOptions({ + maxLines: 30 + }) + ace.config.loadModule("ace/ext/emmet", function() { ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() { embedded_editor.setOption("enableEmmet", true); diff --git a/doc/wiki b/doc/wiki index a3d6d692..d93670b4 160000 --- a/doc/wiki +++ b/doc/wiki @@ -1 +1 @@ -Subproject commit a3d6d69286903155bc7e1e5cd9c0f541791d384b +Subproject commit d93670b47d776987b38bb2c31777c4e488338fac diff --git a/index.html b/index.html index da795d5f..fb658135 100644 --- a/index.html +++ b/index.html @@ -80,7 +80,7 @@ function add(x, y) { var addResult = add(3, 2); console.log(addResult); - +

Looking for a more full-featured demo? Check out the kitchen sink. @@ -330,11 +330,9 @@ var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode; var Mode = function() { // set everything up - var highlighter = new MyNewHighlightRules(); + this.HighlightRules = MyNewHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new MyNewFoldMode(); - - this.$tokenizer = new Tokenizer(highlighter.getRules()); }; oop.inherits(Mode, TextMode); @@ -343,9 +341,8 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; - // Extra logic goes here--we won't be covering all of this - - /* These are all optional pieces of code! + // special logic for indent/outdent. + // By default ace keeps indentation of previous line this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); return indent; @@ -358,14 +355,17 @@ oop.inherits(Mode, TextMode); this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; - + + // create worker for live syntax checking this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker"); worker.attachToDocument(session.getDocument()); - + worker.on("errors", function(e) { + session.setAnnotations(e.data); + }); return worker; }; - */ + }).call(Mode.prototype); exports.Mode = Mode; @@ -499,7 +499,7 @@ var fonts = lang.arrayToMap(

  • Run npm install to install required dependencies.
  • Run node tmlanguage.js <path_to_tmlanguage_file>; for example, node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage
  • -

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into kitchen_sink.html and demo.js, as well as write any tests for the highlighting.

    +

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into ace/ext/modelist.js, and add a sample file for testing.

    A Note on Accuracy

    Your .tmlanguage file will then be converted to the best of the converter’s ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example: