Skip to content

Commit

Permalink
Correct misclassification of .js.erb files (#4427)
Browse files Browse the repository at this point in the history
* Correct misclassification of .js.erb files

Previously JavaScript files containing embedded Ruby, for example
files used to render JavaScript for client-side execution in response
to an AJAX request in a Rails application, were misclassified as HTML+ERB.
This commit corrects this by classifying such source files as JavaScript+ERB
and grouping under the parent JavaScript language.

Signed-off-by: Charlie Jonas <[email protected]>

* Use JavaScript syntax highlighting for JS+ERB
  • Loading branch information
CHTJonas authored and lildude committed May 31, 2019
1 parent 7e1a5e8 commit 9847fcf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,16 @@ JavaScript:
- v8
- v8-shell
language_id: 183
JavaScript+ERB:
type: programming
tm_scope: source.js
group: JavaScript
extensions:
- ".js.erb"
ace_mode: javascript
codemirror_mode: javascript
codemirror_mime_type: application/javascript
language_id: 914318960
Jison:
type: programming
group: Yacc
Expand Down
1 change: 1 addition & 0 deletions samples/JavaScript+ERB/create.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$("<%= escape_javascript(render @model) %>").appendTo("#models");
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Java Properties:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **Java Server Pages:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **JavaScript:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **JavaScript+ERB:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **Jison:** [cdibbs/language-jison](https://github.com/cdibbs/language-jison)
- **Jison Lex:** [cdibbs/language-jison](https://github.com/cdibbs/language-jison)
- **Jolie:** [fmontesi/language-jolie](https://github.com/fmontesi/language-jolie)
Expand Down

0 comments on commit 9847fcf

Please sign in to comment.