Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

HTML Tags: Add support for dash and fix colon in end tag #14

Merged
merged 2 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
Expand Down
14 changes: 14 additions & 0 deletions test/html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
}]
]);