From c5a3cac12f034963e30fbb082598b4cbf1dbef5a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 11 Nov 2012 22:22:28 -0800 Subject: [PATCH] More haml work --- demo/kitchen-sink/docs/haml.haml | 10 +++------- lib/ace/mode/haml_highlight_rules.js | 28 ++++++++++++++-------------- lib/ace/mode/jade_highlight_rules.js | 4 ++-- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/demo/kitchen-sink/docs/haml.haml b/demo/kitchen-sink/docs/haml.haml index aa29cb6a..b3c6debb 100644 --- a/demo/kitchen-sink/docs/haml.haml +++ b/demo/kitchen-sink/docs/haml.haml @@ -5,20 +5,15 @@ -# -# -# 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 +%ads: %p==ddd== Date/Time: - - now = DateTime.now + - now = DateTime.now %strong= now - if now > DateTime.parse("December 31, 2006") = "Happy new " + "year!" @@ -28,6 +23,7 @@ end %h1= @title = link_to 'Home', home_url + #contents %div#content %div.articles %div.article.title Blah diff --git a/lib/ace/mode/haml_highlight_rules.js b/lib/ace/mode/haml_highlight_rules.js index 065def6a..fb3da22f 100644 --- a/lib/ace/mode/haml_highlight_rules.js +++ b/lib/ace/mode/haml_highlight_rules.js @@ -76,9 +76,9 @@ var HamlHighlightRules = function() { // "regex": "^( *)(/)\\s*$", // "next": "state_4" //}, - { - "token": ["meta.tag.haml", "punctuation.definition.tag.haml", "entity.name.tag.haml"], - "regex": /^\s*(?:((%)([\w:]+))|(?=\.|#))/, + { + "token": ["entity.name.tag.haml"], + "regex": /^\s*%[\w:]+/, "next": "tag_single" }, { @@ -154,17 +154,17 @@ var HamlHighlightRules = function() { ],*/ "tag_single": [ { - "token": "suport.type.attribute.class.jade", + "token": "entity.other.attribute-name.class.haml", "regex": "\\.[\\w-]+" }, { - "token": "suport.type.attribute.id.jade", + "token": "entity.other.attribute-name.id.haml", "regex": "#[\\w-]+" }, - //{ - // "token": "meta.section.attributes.haml", - // "regex": "" - //}, + { + "token": "meta.section.attributes.haml", + "regex": "\\{(?=.*\\}|.*\\|\\s*$)" + }, //{ // "token": "meta.section.object.haml", // "regex": "" @@ -176,11 +176,11 @@ var HamlHighlightRules = function() { // "token": "punctuation.terminator.tag.haml", // "regex": "/" //}, - //{ - // "token": "TODO", - // "regex": "$|(?!\\.|#|\\{|\\[|=|-|~|/)", - // "next": "start" - //} + { + "token": ["text", "punctuation"], + "regex": "($)|((?!\\.|#|=|-))", + "next": "start" + } ]/*, "state_7": [ { diff --git a/lib/ace/mode/jade_highlight_rules.js b/lib/ace/mode/jade_highlight_rules.js index bf266ce7..1f8b5875 100644 --- a/lib/ace/mode/jade_highlight_rules.js +++ b/lib/ace/mode/jade_highlight_rules.js @@ -206,11 +206,11 @@ var JadeHighlightRules = function() { ],*/ "tag_single": [ { - "token": "suport.type.attribute.class.jade", + "token": "entity.other.attribute-name.class.jade", "regex": "\\.[\\w-]+" }, { - "token": "suport.type.attribute.id.jade", + "token": "entity.other.attribute-name.id.jade", "regex": "#[\\w-]+" }, {