Skip to content

Commit

Permalink
recognize dashed attribute names in tags
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot committed Jul 7, 2022
1 parent 7f8545b commit 95a2961
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ecmarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type {
TickNode,
TildeNode,
PipeNode,
FragmentNode,
FormatNode,
UnorderedListNode,
OrderedListNode,
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Unlocated, Token, AttrToken, Position } from './node-types';

const tagRegexp = /^<[/!]?(\w[\w-]*)(\s+[\w]+(\s*=\s*("[^"]*"|'[^']*'|[^><"'=``]+))?)*\s*>/;
const tagRegexp = /^<[/!]?(\w[\w-]*)(\s+\w[\w-]*(\s*=\s*("[^"]*"|'[^']*'|[^><"'=`]+))?)*\s*>/;
const commentRegexp = /^<!--[\w\W]*?-->/;
const attrRegexp = /^\[ *[\w-]+ *= *"(?:[^"\\\x00-\x1F]|\\["\\/bfnrt]|\\u[a-fA-F]{4})*" *(?:, *[\w-]+ *= *"(?:[^"\\\x00-\x1F]|\\["\\/bfnrt]|\\u[a-fA-F]{4})*" *)*] /;
const digitRegexp = /\d/;
Expand Down
1 change: 1 addition & 0 deletions test/tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ describe('Token:', function () {
'<tag attr=">">',
'<tag attr="\'">',
"<tag attr='foo'>",
"<tag dashed-attr='foo'>",
];

validTags.forEach(function (tag) {
Expand Down

0 comments on commit 95a2961

Please sign in to comment.