Start haml

This commit is contained in:
Garen Torikian 2012-11-11 00:14:07 -08:00 committed by nightwing
commit 3dce122f8c
5 changed files with 366 additions and 0 deletions

View file

@ -76,6 +76,7 @@ var docs = {
"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/jade.jade": "Jade",

View file

@ -0,0 +1,40 @@
!!!5
-# <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
-# <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
-# <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
-# <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
# file: app/controllers/movies_controller.rb
class MoviesController < ApplicationController
def index
@title = "Teen Wolf"
end
end
/adasdasdad
%div{:id => "#{@item.type}_#{@item.number}", :class => "#{@item.type} #{@item.urgency}"}
-# file: app/views/movies/index.html.haml
\d
%p==ddd==
Date/Time:
- now = DateTime.now
%strong= now
- if now > DateTime.parse("December 31, 2006")
= "Happy new " + "year!"
%sfd.dfdfg
#content
.title
%h1= @title
= link_to 'Home', home_url
%div#content
%div.articles
%div.article.title Blah
%div.article.date 2006-11-05
%div.article.entry
Neil Patrick Harris
%div[@user, :greeting]
%bar[290]/
Hello!

View file

@ -46,6 +46,7 @@ var modesByName = {
golang: ["Go" , "go"],
groovy: ["Groovy" , "groovy"],
haxe: ["haXe" , "hx"],
haml: ["HAML" , "haml"],
html: ["HTML" , "htm|html|xhtml"],
c_cpp: ["C/C++" , "c|cc|cpp|cxx|h|hh|hpp"],
clojure: ["Clojure" , "clj"],

60
lib/ace/mode/haml.js Normal file
View file

@ -0,0 +1,60 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
* Garen J. Torikian < gjtorikian AT gmail DOT com >
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
var Mode = function() {
var highlighter = new HamlHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,264 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
* Garen J. Torikian < gjtorikian AT gmail DOT com >
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY Haml.tmlanguage (UUID: 3D727049-DD05-45DF-92A5-D50EA36FD035) */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
var HamlHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules =
{
"start": [
{
"token": "string.quoted.double",
"regex": "==.+?=="
},
{
"token": "keyword.other.doctype",
"regex": "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
},
{
token : "comment",
regex : /\/.*$/
},
//{
// "token": [
// {
// "2": {
// "name": "punctuation.section.comment.haml"
// }
// },
// "comment.block.haml"
// ],
// "regex": "^( *)(/)\\s*$",
// "next": "state_4"
//},
{
"token": ["meta.tag.haml", "punctuation.definition.tag.haml", "entity.name.tag.haml"],
"regex": /^\s*(?:((%)([\w:]+))|(?=\.|#))/,
"next": "tag_single"
},
{
"token": [ "meta.escape.haml" ],
"regex": "^\\s*\\\\."
},
//{
// "token": [
// null
// ],
// "regex": "^\\s*(?==|-|~)",
// "next": "state_7"
//}
],
/*"interpolated_ruby": [
{
"token": [ "punctuation.section.embedded.ruby", "source.ruby.embedded.source.empty",
"regex": "(?:#\\{(\\}))",
},
{
"begin": "#\\{",
"captures": {
"0": {
"name": "punctuation.section.embedded.ruby"
}
},
"end": "(\\})",
"name": "source.ruby.embedded.source",
"patterns": [
{
"include": "#nest_curly_and_self"
},
]
},
{
"captures": {
"1": {
"name": "punctuation.definition.variable.ruby"
}
},
"regex": "(#@)[a-zA-Z_]\\w*",
"name": "variable.other.readwrite.instance.ruby"
},
{
"captures": {
"1": {
"name": "punctuation.definition.variable.ruby"
}
},
"regex": "(#@@)[a-zA-Z_]\\w*",
"name": "variable.other.readwrite.class.ruby"
},
{
"captures": {
"1": {
"name": "punctuation.definition.variable.ruby"
}
},
"regex": "(#\\$)[a-zA-Z_]\\w*",
"name": "variable.other.readwrite.global.ruby"
}
]
],*//*
"state_4": [
{
"include": "text.haml"
},
{
"token": "TODO",
"regex": "^(?!\\1 )",
"next": "start"
}
],*/
"tag_single": [
{
"token": "suport.type.attribute.class.jade",
"regex": "\\.[\\w-]+"
},
{
"token": "suport.type.attribute.id.jade",
"regex": "#[\\w-]+"
},
//{
// "token": "meta.section.attributes.haml",
// "regex": ""
//},
//{
// "token": "meta.section.object.haml",
// "regex": ""
//},
//{
// "include": "#rubyline"
//},
//{
// "token": "punctuation.terminator.tag.haml",
// "regex": "/"
//},
//{
// "token": "TODO",
// "regex": "$|(?!\\.|#|\\{|\\[|=|-|~|/)",
// "next": "start"
//}
]/*,
"state_7": [
{
"include": "#rubyline"
},
{
"token": "TODO",
"regex": "$",
"next": "start"
}
]*/
}
/*** START REPOSITORY RULES
{
"continuation": {
"captures": {
"1": {
"name": "punctuation.separator.continuation.haml"
}
},
"regex": "(\\|)\\s*\\n"
},
},
"nest_curly_and_self": {
"patterns": [
{
"begin": "\\{",
"captures": {
"0": {
"name": "punctuation.section.scope.ruby"
}
},
"end": "\\}",
"patterns": [
{
"include": "#nest_curly_and_self"
}
]
},
{
"include": "source.ruby"
}
]
},
"rubyline": {
"begin": "=|-|~",
"contentName": "source.ruby.embedded.haml",
"end": "((do|\\{)( \\|[^|]+\\|)?)$|$|^(?!.*\\|\\s*$)",
"endCaptures": {
"1": {
"name": "source.ruby.embedded.html"
},
"2": {
"name": "keyword.control.ruby.start-block"
}
},
"name": "meta.line.ruby.haml",
"patterns": [
{
"comment": "Hack to let ruby comments work in this context properly",
"regex": "#.*$",
"name": "comment.line.number-sign.ruby"
},
{
"include": "source.ruby.rails"
},
{
"include": "#continuation"
}
]
}
}
END REPOSITORY RULES ***/
};
oop.inherits(HamlHighlightRules, TextHighlightRules);
exports.HamlHighlightRules = HamlHighlightRules;
});