Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
normalizing tagName for syntax highlight
Browse files Browse the repository at this point in the history
related #44
  • Loading branch information
outsideris committed Oct 9, 2015
1 parent 33b937e commit 9d40ea9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grammars/angularjs.cson
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
]
'patterns': [
{
'begin': '(</?)((?i:ng-(form|include|pluralize|transclude|view|messages|message))\\b)'
'begin': '(</?)((?i:(data-|x-)?ng(-|_|:)(form|include|pluralize|transclude|view|messages|message))\\b)'
'beginCaptures':
'1':
'name': 'punctuation.definition.tag.begin.html'
Expand Down
32 changes: 32 additions & 0 deletions spec/grammar-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,38 @@ describe 'directive grammar', ->

expect(lines[0][3]).toEqual value: 'ng:controller', scopes: ['text.html.angular', 'meta.tag.inline.any.html', 'meta.attribute.html.angular', 'entity.other.attribute-name.html.angular']

it 'tokenizes data- prefixed angular element', ->
lines = grammar.tokenizeLines '''
<data-ng-include src=""></data-ng-include>
'''

expect(lines[0][1]).toEqual value: 'data-ng-include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']
expect(lines[0][5]).toEqual value: 'data-ng-include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']

it 'tokenizes x- prefixed angular element', ->
lines = grammar.tokenizeLines '''
<x-ng-include src=""></x-ng-include>
'''

expect(lines[0][1]).toEqual value: 'x-ng-include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']
expect(lines[0][5]).toEqual value: 'x-ng-include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']

it 'tokenizes _ suffixed angular element', ->
lines = grammar.tokenizeLines '''
<ng_include src=""></ng_include>
'''

expect(lines[0][1]).toEqual value: 'ng_include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']
expect(lines[0][5]).toEqual value: 'ng_include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']

it 'tokenizes : suffixed angular element', ->
lines = grammar.tokenizeLines '''
<ng:include src=""></ng:include>
'''

expect(lines[0][1]).toEqual value: 'ng:include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']
expect(lines[0][5]).toEqual value: 'ng:include', scopes: ['text.html.angular', 'meta.tag.block.any.html', 'entity.name.tag.block.any.html.angular']

describe 'angular expression', ->
it 'tokenizes angular expressions in HTML tags', ->
lines = grammar.tokenizeLines '''
Expand Down

0 comments on commit 9d40ea9

Please sign in to comment.