Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix JS highlight rules embedded in Jade #1016

Merged
merged 1 commit into from

2 participants

@gjtorikian
Collaborator

oops! I just noticed that JS highlighting rules embedded in Jade were not being highlighted. I'm not sure why I didn't do this in the beginning, maybe I forgot to get back to it?

@nightwing nightwing commented on the diff
lib/ace/mode/jade_highlight_rules.js
((6 lines not shown))
"token": "source.js.embedded.jade",
- "regex": "^\\s*-|=|!=",
- "next": "js_code"
- },*/
+ "regex": "^\\s*(?:-|=|!=)",
@nightwing Owner

what is this shouldn't script tag start js mode?

@gjtorikian Collaborator

that is one of the ways--missing from this highlighter at the moment!

But you can also indicate javascript with - as a prefix; see:

https://github.com/miksago/jade-tmbundle/blob/master/Syntaxes/Jade.tmLanguage

or

https://github.com/visionmedia/jade#code

I'm not sure what != is for but it was in the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@nightwing nightwing merged commit 063e844 into master
@nightwing
Owner

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 6, 2012
  1. @gjtorikian

    Fix JS highlight rules

    gjtorikian authored
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 6 deletions.
  1. +26 −6 lib/ace/mode/jade_highlight_rules.js
View
32 lib/ace/mode/jade_highlight_rules.js
@@ -120,11 +120,11 @@ var JadeHighlightRules = function() {
"token": [ "storage.type.function.jade", "entity.name.function.jade"],
"regex": "^(\\s*mixin)( [\\w\\-]+)"
},
- /* {
+ {
"token": "source.js.embedded.jade",
- "regex": "^\\s*-|=|!=",
- "next": "js_code"
- },*/
+ "regex": "^\\s*(?:-|=|!=)",
@nightwing Owner

what is this shouldn't script tag start js mode?

@gjtorikian Collaborator

that is one of the ways--missing from this highlighter at the moment!

But you can also indicate javascript with - as a prefix; see:

https://github.com/miksago/jade-tmbundle/blob/master/Syntaxes/Jade.tmLanguage

or

https://github.com/visionmedia/jade#code

I'm not sure what != is for but it was in the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ "next": "js-start"
+ },
/*{
"token": "entity.name.tag.script.jade",
"regex": "^\\s*script",
@@ -219,7 +219,21 @@ var JadeHighlightRules = function() {
"next": "start"
}
],
- "tag_attributes": [
+ "tag_attributes": [
+ {
+ "token" : "string",
+ "regex" : "'(?=.)",
+ "next" : "qstring"
+ },
+ {
+ "token" : "string",
+ "regex" : '"(?=.)',
+ "next" : "qqstring"
+ },
+ {
+ "token": "entity.other.attribute-name.jade",
+ "regex": "\\b[a-zA-Z\\-:]+"
+ },
{
"token": ["entity.other.attribute-name.jade", "punctuation"],
"regex": "\\b([a-zA-Z:\\.-]+)(=)",
@@ -284,6 +298,12 @@ var JadeHighlightRules = function() {
}
]
};
+
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
+ token: "text",
+ regex: ".$",
+ next: "start"
+ }]);
/*
this.embedRules(MarkdownHighlightRules, "markdown-", [{
token : "support.function",
@@ -324,4 +344,4 @@ var JadeHighlightRules = function() {
oop.inherits(JadeHighlightRules, TextHighlightRules);
exports.JadeHighlightRules = JadeHighlightRules;
-});
+});
Something went wrong with that request. Please try again.