simple handlebars mode

This commit is contained in:
nightwing 2013-09-08 22:19:15 +04:00
commit 3be21b77e5
6 changed files with 130 additions and 5 deletions

View file

@ -0,0 +1,8 @@
{{!-- Ace + :-}} --}}
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}
</div>

View file

@ -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];

View file

@ -70,11 +70,12 @@ var supportedModes = {
golang: ["go"],
Groovy: ["groovy"],
HAML: ["haml"],
Handlebars: ["hbs|handlebars|tpl|mustache"],
Haskell: ["hs"],
haXe: ["hx"],
HTML: ["htm|html|xhtml"],
HTML_Ruby: ["erb|rhtml|html.erb"],
Ini: ["ini|conf"],
INI: ["ini|conf|cfg|prefs"],
Jade: ["jade"],
Java: ["java"],
JavaScript: ["js"],
@ -135,9 +136,10 @@ var supportedModes = {
Typescript: ["ts|typescript|str"],
VBScript: ["vbs"],
Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
XQuery: ["xq"],
YAML: ["yaml"]
YAML: ["yaml|yml"]
};
var nameOverrides = {

View file

@ -0,0 +1,31 @@
/* global define */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlMode = require("./html").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules;
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
var HtmlFoldMode = require("./folding/html").FoldMode;
var Mode = function() {
HtmlMode.call(this);
var highlighter = new HandlebarsHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$behaviour = new HtmlBehaviour();
this.$embeds = highlighter.getEmbeds();
this.foldingRules = new HtmlFoldMode();
};
oop.inherits(Mode, HtmlMode);
(function() {
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,72 @@
/* global define */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var xmlUtil = require("./xml_util");
function pop2(currentState, stack) {
stack.splice(0, 3);
return stack.shift() || "start";
}
var HandlebarsHighlightRules = function() {
HtmlHighlightRules.call(this);
var hbs = {
regex : "(?={{)",
push : "handlebars"
}
for (var key in this.$rules) {
this.$rules[key].unshift(hbs);
}
this.$rules.handlebars = [{
token : "comment.start",
regex : "{{!--",
push : [{
token : "comment.end",
regex : "--}}",
next : pop2
}, {
defaultToken : "comment"
}]
}, {
token : "comment.start",
regex : "{{!",
push : [{
token : "comment.end",
regex : "}}",
next : pop2
}, {
defaultToken : "comment"
}]
}, {
token : "storage.type.start", // begin section
regex : "{{[#\\^/&]?",
push : [{
token : "storage.type.end",
regex : "}}",
next : pop2
}, {
token : "variable.parameter",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
}]
}, {
token : "support.function", // unescaped variable
regex : "{{{",
push : [{
token : "support.function",
regex : "}}}",
next : pop2
}, {
token : "variable.parameter",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
}]
}];
this.normalizeRules();
};
oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules);
exports.HandlebarsHighlightRules = HandlebarsHighlightRules;
});

View file

@ -46,9 +46,9 @@ var Mode = function() {
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({
"js-": JavaScriptMode,
"xml-": XmlMode,
"html-": HtmlMode
"js-": JavaScriptMode,
"xml-": XmlMode,
"html-": HtmlMode
});
this.foldingRules = new MarkdownFoldMode();