fix tripple brace highlighting in handlebars mode

This commit is contained in:
nightwing 2014-11-06 20:41:25 +04:00
commit 072dcb1c11
8 changed files with 483 additions and 13 deletions

View file

@ -3,6 +3,6 @@
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
<div>{{{body}}}</div>
{{/each}}
</div>

View file

@ -0,0 +1,267 @@
[[
"start",
["comment.line.double-dash","-- https://github.com/Cirru/cirru-gopher/blob/master/code/scope.cr,"]
],[
"start"
],[
"line",
["support.function","set"],
["text"," "],
["variable.parameter","a"],
["text"," "],
["storage.modifier","("],
["support.function","int"],
["text"," "],
["constant.numeric","2"],
["storage.modifier",")"]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","("],
["support.function","self"],
["storage.modifier",")"]
],[
"start"
],[
"line",
["support.function","set"],
["text"," "],
["variable.parameter","c"],
["text"," "],
["storage.modifier","("],
["support.function","child"],
["storage.modifier",")"]
],[
"start"
],[
"line",
["support.function","under"],
["text"," "],
["variable.parameter","c"]
],[
"line",
["markup.raw"," "],
["support.function","under"],
["text"," "],
["variable.parameter","parent"]
],[
"line",
["markup.raw"," "],
["support.function","print"],
["text"," "],
["variable.parameter","a"]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","get"],
["text"," "],
["variable.parameter","c"],
["text"," "],
["variable.parameter","a"]
],[
"start"
],[
"line",
["support.function","set"],
["text"," "],
["variable.parameter","c"],
["text"," "],
["variable.parameter","x"],
["text"," "],
["storage.modifier","("],
["support.function","int"],
["text"," "],
["constant.numeric","3"],
["storage.modifier",")"]
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","get"],
["text"," "],
["variable.parameter","c"],
["text"," "],
["variable.parameter","x"]
],[
"start"
],[
"line",
["support.function","set"],
["text"," "],
["variable.parameter","just-print"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","code"]
],[
"line",
["markup.raw"," "],
["support.function","print"],
["text"," "],
["variable.parameter","a"]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["variable.parameter","just-print"]
],[
"start"
],[
"line",
["support.function","eval"],
["text"," "],
["storage.modifier","("],
["support.function","self"],
["storage.modifier",")"],
["text"," "],
["variable.parameter","just-print"]
],[
"line",
["support.function","eval"],
["text"," "],
["variable.parameter","just-print"]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","("],
["support.function","string"],
["text"," "],
["string.quoted.double","\"string with space\""],
["storage.modifier",")"]
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","("],
["support.function","string"],
["text"," "],
["string.quoted.double","\"escapes "],
["constant.character.escape","\\n"],
["string.quoted.double"," "],
["constant.character.escape","\\\"\\\\"],
["string.quoted.double","\""],
["storage.modifier",")"]
],[
"start"
],[
"start",
["support.function","brackets"],
["text"," "],
["storage.modifier","((((()))))"]
],[
"start"
],[
"line",
["string.quoted.double","\"eval\""],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","string"],
["text"," "],
["string.quoted.double","\"eval\""]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["storage.modifier","("],
["support.function","add"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["storage.modifier","("],
["support.function","int"],
["text"," "],
["constant.numeric","1"],
["storage.modifier",")"],
["text"," "],
["storage.modifier","("],
["support.function","int"],
["text"," "],
["constant.numeric","2"],
["storage.modifier","))"]
],[
"start"
],[
"start",
["support.function","print"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","unwrap"],
["text"," "],
["storage.modifier","$"]
],[
"line",
["text"," "],
["support.function","map"],
["text"," "],
["storage.modifier","("],
["support.function","a"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","int"],
["text"," "],
["constant.numeric","1"],
["storage.modifier",")"],
["text"," "],
["storage.modifier","("],
["support.function","b"],
["text"," "],
["storage.modifier","$"],
["text"," "],
["support.function","int"],
["text"," "],
["constant.numeric","2"],
["storage.modifier",")"]
],[
"start"
],[
"line",
["support.function","print"],
["text"," "],
["variable.parameter","a"]
],[
"line",
["markup.raw"," "],
["support.function","int"],
["text"," "],
["constant.numeric","1"]
],[
"line",
["markup.raw"," "],
["storage.modifier",","],
["text"," "],
["variable.parameter","b"],
["text"," "],
["variable.parameter","c"]
],[
"line",
["markup.raw"," "],
["support.function","int"],
["text"," "],
["constant.numeric","2"]
],[
"line",
["markup.raw"," "],
["storage.modifier",","],
["text"," "],
["variable.parameter","d"]
]]

View file

@ -0,0 +1,196 @@
[[
"start",
["keyword.control.module.elixir","defmodule"],
["meta.module.elixir"," "],
["entity.name.type.module.elixir","HelloModule"],
["text"," "],
["keyword.control.elixir","do"]
],[
"comment.documentation.heredoc",
["text"," "],
["comment.documentation.heredoc","@moduledoc \"\"\""]
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," This is supposed to be `markdown`."]
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," __Yes__ this is [mark](http://down.format)"]
],[
"comment.documentation.heredoc"
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," # Truly"]
],[
"comment.documentation.heredoc"
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," ## marked"]
],[
"comment.documentation.heredoc"
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," * with lists"]
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," * more"]
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," * and more"]
],[
"comment.documentation.heredoc"
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," Even.with(code)"]
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," blocks |> with |> samples"]
],[
"comment.documentation.heredoc"
],[
"comment.documentation.heredoc",
["comment.documentation.heredoc"," _Docs are first class citizens in Elixir_ (Jose Valim)"]
],[
"start",
["comment.documentation.heredoc"," \"\"\""]
],[
"start",
["text"," "]
],[
"start",
["text"," "],
["punctuation.definition.comment.elixir","#"],
["comment.line.number-sign.elixir"," A \"Hello world\" function"]
],[
"start",
["text"," "],
["keyword.control.elixir","def"],
["text"," some_fun "],
["keyword.control.elixir","do"]
],[
"start",
["text"," "],
["variable.other.constant.elixir","IO"],
["punctuation.separator.method.elixir","."],
["text","puts "],
["punctuation.definition.string.begin.elixir","\""],
["string.quoted.double.elixir","Juhu Kinners!"],
["punctuation.definition.string.end.elixir","\""]
],[
"start",
["text"," "],
["keyword.control.elixir","end"]
],[
"start",
["text"," "],
["punctuation.definition.comment.elixir","#"],
["comment.line.number-sign.elixir"," A private function"]
],[
"start",
["text"," "],
["keyword.control.elixir","defp"],
["text"," priv "],
["keyword.control.elixir","do"]
],[
"punctuation.definition.string.begin.elixir7",
["text"," is_regex "],
["punctuation.definition.string.begin.elixir","~r\"\"\""]
],[
"punctuation.definition.string.begin.elixir7",
["string.quoted.double.heredoc.elixir"," This is a regex"]
],[
"punctuation.definition.string.begin.elixir7",
["string.quoted.double.heredoc.elixir"," spanning several"]
],[
"punctuation.definition.string.begin.elixir7",
["string.quoted.double.heredoc.elixir"," lines."]
],[
"start",
["punctuation.definition.string.end.elixir"," \"\"\""]
],[
"start",
["text"," x "],
["keyword.operator.assignment.elixir","="],
["text"," elem"],
["punctuation.section.function.elixir","("],
["punctuation.section.scope.elixir","{"],
["text"," "],
["punctuation.definition.constant.elixir",":"],
["constant.other.symbol.elixir","a"],
["punctuation.separator.object.elixir",","],
["text"," "],
["punctuation.definition.constant.elixir",":"],
["constant.other.symbol.elixir","b"],
["punctuation.separator.object.elixir",","],
["text"," "],
["punctuation.definition.constant.elixir",":"],
["constant.other.symbol.elixir","c"],
["text"," "],
["punctuation.section.scope.elixir","}"],
["punctuation.separator.object.elixir",","],
["text"," "],
["constant.numeric.elixir","0"],
["punctuation.section.function.elixir",")"],
["text"," "],
["punctuation.definition.comment.elixir","#"],
["comment.line.number-sign.elixir","=> :a"]
],[
"start",
["text"," "],
["keyword.control.elixir","end"]
],[
"start",
["keyword.control.elixir","end"]
],[
"start"
],[
"start",
["text","test_fun "],
["keyword.operator.assignment.elixir","="],
["text"," "],
["keyword.control.elixir","fn"],
["punctuation.section.function.elixir","("],
["text","x"],
["punctuation.section.function.elixir",")"],
["text"," "],
["keyword.operator.arithmetic.elixir","-"],
["keyword.operator.comparison.elixir",">"]
],[
"start",
["text"," "],
["keyword.control.elixir","cond"],
["text"," "],
["keyword.control.elixir","do"]
],[
"start",
["text"," x "],
["keyword.operator.comparison.elixir",">"],
["text"," "],
["constant.numeric.elixir","10"],
["text"," "],
["keyword.operator.arithmetic.elixir","-"],
["keyword.operator.comparison.elixir",">"]
],[
"start",
["text"," "],
["punctuation.definition.constant.elixir",":"],
["constant.other.symbol.elixir","greater_than_ten"]
],[
"start",
["text"," "],
["constant.language.elixir","true"],
["text"," "],
["keyword.operator.arithmetic.elixir","-"],
["keyword.operator.comparison.elixir",">"]
],[
"start",
["text"," "],
["punctuation.definition.constant.elixir",":"],
["constant.other.symbol.elixir","maybe_ten"]
],[
"start",
["text"," "],
["keyword.control.elixir","end"]
],[
"start",
["keyword.control.elixir","end"]
]]

View file

@ -59,9 +59,9 @@
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.tag-name.xml","div"],
["meta.tag.punctuation.tag-close.xml",">"],
["storage.type.start","{{"],
["support.function","{{{"],
["variable.parameter","body"],
["storage.type.end","}}"],
["support.function","}}}"],
["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.tag-name.xml","div"],
["meta.tag.punctuation.tag-close.xml",">"]

View file

@ -21,7 +21,7 @@ var Mode = function() {
oop.inherits(Mode, HtmlMode);
(function() {
this.blockComment = {start: "{!--", end: "--}"};
this.$id = "ace/mode/handlebars";
}).call(Mode.prototype);

View file

@ -15,7 +15,7 @@ var HandlebarsHighlightRules = function() {
var hbs = {
regex : "(?={{)",
push : "handlebars"
}
};
for (var key in this.$rules) {
this.$rules[key].unshift(hbs);
}
@ -40,22 +40,22 @@ var HandlebarsHighlightRules = function() {
defaultToken : "comment"
}]
}, {
token : "storage.type.start", // begin section
regex : "{{[#\\^/&]?",
token : "support.function", // unescaped variable
regex : "{{{",
push : [{
token : "storage.type.end",
regex : "}}",
token : "support.function",
regex : "}}}",
next : pop2
}, {
token : "variable.parameter",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
}]
}, {
token : "support.function", // unescaped variable
regex : "{{{",
token : "storage.type.start", // begin section
regex : "{{[#\\^/&]?",
push : [{
token : "support.function",
regex : "}}}",
token : "storage.type.end",
regex : "}}",
next : pop2
}, {
token : "variable.parameter",

View file

@ -0,0 +1,7 @@
define(function(require, exports, module) {
"use strict";
exports.snippetText = require("../requirejs/text!./.snippets");
exports.scope = "";
});

View file