From 4e97f005e6c3266b649d7c79f977812b6e4e19f1 Mon Sep 17 00:00:00 2001 From: AndersMad Date: Wed, 29 Mar 2017 12:08:42 +0200 Subject: [PATCH 1/2] Tags: Add support for dash and fix colon in end tag --- src/html.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/html.ts b/src/html.ts index 827226a1..c9ebc147 100644 --- a/src/html.ts +++ b/src/html.ts @@ -76,11 +76,11 @@ export var language = { root: [ [/)/, [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' }]], [/ Date: Thu, 8 Jun 2017 15:53:18 +0200 Subject: [PATCH 2/2] Add test for PR#14 --- test/html.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/html.test.ts b/test/html.test.ts index 8ca0ef85..6ae085ff 100644 --- a/test/html.test.ts +++ b/test/html.test.ts @@ -599,5 +599,19 @@ testTokenization(['html', 'css'], [ { startIndex:0, type: DOCTYPE }, { startIndex:11, type: DELIM_DOCTYPE } ] + }], + + // PR #14 + [{ + line: 'asd', + 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 } + ] }] ]);