Merge pull request #14 from AndersMad/master

HTML Tags: Add support for dash and fix colon in end tag
pull/2748/head
Alexandru Dima 8 years ago committed by GitHub
commit 37e390f5ae

@ -76,11 +76,11 @@ export var language = <ILanguage> {
root: [
[/<!DOCTYPE/, 'metatag', '@doctype'],
[/<!--/, 'comment', '@comment'],
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag', htmlTokenTypes.DELIM_END]],
[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag', '', htmlTokenTypes.DELIM_END]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@script'} ]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@style'} ]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag'} ]],
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
[/(<)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
[/</, htmlTokenTypes.DELIM_START],
[/[^<]+/], // text
],

@ -599,5 +599,19 @@ testTokenization(['html', 'css'], [
{ startIndex:0, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE }
]
}],
// PR #14
[{
line: '<asdf:bar>asd</asdf:bar>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('asdf:bar') },
{ startIndex:9, type: DELIM_END },
{ startIndex:10, type: '' },
{ startIndex:13, type: DELIM_START },
{ startIndex:15, type: getTag('asdf:bar') },
{ startIndex:23, type: DELIM_END }
]
}]
]);

Loading…
Cancel
Save