Skip to content

Commit

Permalink
fix(syntax): correctly tokenize any elements with dash, resolves #41
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Lieben committed Apr 19, 2017
1 parent 6007c1f commit db6fc47
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions syntaxes/html.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"name": "meta.string.interpolation"
},
"meta.tag.block.any.html": {
"begin": "(<\/?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)\\b)",
"begin": "(<\/?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)(?!-)\\b)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
Expand All @@ -64,7 +64,7 @@
]
},
"meta.tag.inline.any.html": {
"begin": "(<\/?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\\b)",
"begin": "(<\/?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)(?!-)\\b)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
Expand Down
30 changes: 29 additions & 1 deletion test/syntax.html/generic.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from 'chai';
import { getTokenOnCharRange, hasScope, tokenizeLine } from './test.utils';
import { getTokenOnCharRange, hasScope, tokenizeLine, writeOut } from './test.utils';

describe('The Aurelia HTML syntax', () => {

Expand Down Expand Up @@ -59,4 +59,32 @@ describe('The Aurelia HTML syntax', () => {

});

it('must tokenize inline element with dash as scope "entity.name.tag.other.html"', () => {

// arrange
let scope = 'entity.name.tag.other.html';

// act
let lineToken = tokenizeLine('<input-type>');

// assert
let token = getTokenOnCharRange(lineToken, 1, 11);
assert.isOk(hasScope(token.scopes, scope));

});

it('must tokenize block element with dash as scope "entity.name.tag.other.html"', () => {

// arrange
let scope = 'entity.name.tag.other.html';

// act
let lineToken = tokenizeLine('<aside-type>');

// assert
let token = getTokenOnCharRange(lineToken, 1, 11);
assert.isOk(hasScope(token.scopes, scope));

});

});

0 comments on commit db6fc47

Please sign in to comment.