From 40114475262ca69fbb06d56a07ae2571f49482d9 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 21 Jan 2013 17:54:57 +0400 Subject: [PATCH] update documentation --- doc/site/style.css | 9 +++++ index.html | 70 +++++++++++++----------------------- lib/ace/mode/_test/Readme.md | 2 +- 3 files changed, 34 insertions(+), 47 deletions(-) diff --git a/doc/site/style.css b/doc/site/style.css index 8c4c4ed9..45e359b0 100644 --- a/doc/site/style.css +++ b/doc/site/style.css @@ -480,4 +480,13 @@ p.highlight_note a { /*https://github.com/twitter/bootstrap/issues/5262*/ img { max-width: none; +} + +.text-logo{ + color: black; + font-size: 24px; + font-weight: lighter; + margin-top: 23px; + text-align: center; + text-shadow: 1px 17px 2px gray, 1px 1px 2px gray; } \ No newline at end of file diff --git a/index.html b/index.html index 56a2765e..a162e744 100644 --- a/index.html +++ b/index.html @@ -657,50 +657,14 @@ oop.inherits(FoldMode, BaseFoldMode);

Once you set this up, you should see be able to witness a live demonstration of your new highlighter.

Adding Automated Tests

-

It's also suggested that you go one step further and define some automated tests to test your syntax highlighter. A basic test looks something like this:

-
if (typeof process !== "undefined") {
-    require("amd-loader");
-}
-
-define(function(require, exports, module) {
-"use strict";
-
-var MyNewLanguage = require("./mynewlanguage").Mode;
-var assert = require("../test/assertions");
-
-module.exports = {
-
-    name: "MyNewLanguage Tokenizer",
-
-    setUp : function() {
-        this.tokenizer = new MyNewLanguage().getTokenizer();
-    },
-
-    "test: my random description" : function() {
-        var line = "-12px";
-        var tokens = this.tokenizer.getLineTokens(line, "ruleset").tokens;
-
-        assert.equal(2, tokens.length);
-        assert.equal("constant.numeric", tokens[0].type);
-    },
-
-    "test: tokenize more than one thing" : function() {
-        var tokens = this.tokenizer.getLineTokens("{()}", "start").tokens;
-
-        assert.equal(3, tokens.length);
-        assert.equal("paren.lparen", tokens[0].type);
-        assert.equal("text", tokens[1].type);
-        assert.equal("paren.rparen", tokens[2].type);
-    },
-};
-
-});
-
-if (typeof module !== "undefined" && module === require.main) {
-    require("asyncjs").test.testcase(module.exports).exec()
-}
-

All tests contain a string describing what the test is doing. Then, you define an arbitrary line that you want your tokenizer to check. It's recommended that you test both the number of tokens found, as well as the values of those tokens.

-

Any file ending with the _test.js suffix are automatically run by Ace's Travis CI server.

+

Adding automated tests for a highlighter is trivial so you are not required to do it, but it can help during development.

+

In lib/ace/mode/_test create a file named

text_<modeName>.txt
with some example code. (You can skip this if the document you have added in demo/docs both looks good and covers various edge cases in your language syntax). +

+

Run node highlight_rules_test.js -gen to preserve current output of your tokenizer in tokens_<modeName>.json +

+

After this running highlight_rules_test.js optionalLanguageName will compare output of your tokenizer with the correct output you've created. +

+

Any files ending with the _test.js suffix are automatically run by Ace's Travis CI server.

@@ -912,10 +876,22 @@ module.exports = { Drive Notepad
  • - + PHP Assist
  • +
  • + + Dillinger +
  • +
  • + + Evaluzio +
  • +
  • + + Edicy +
  • BonsaiJS playground
  • @@ -941,6 +917,7 @@ module.exports = { PythonAnywhere
  • + ShareJS
  • @@ -953,6 +930,7 @@ module.exports = { Neutron IDE
  • + tmpltr
  • diff --git a/lib/ace/mode/_test/Readme.md b/lib/ace/mode/_test/Readme.md index 6b5ed443..c2871c0d 100644 --- a/lib/ace/mode/_test/Readme.md +++ b/lib/ace/mode/_test/Readme.md @@ -2,7 +2,7 @@ They are generated from `text_.txt` or `demo/kitchen-sink/doc/*` with ```sh -node highlight_rules_test.js gen +node highlight_rules_test.js -gen ``` command.