Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix too many colens
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jan 18, 2022
1 parent 12c3016 commit 5f2bc30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/linkify-matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ function matrixOpaqueIdLinkifyParser({
LOCALPART_STATE_DOT.tt(token, LOCALPART_STATE);
}

const DOMAINPART_STATE = LOCALPART_STATE.tt(COLON);
const DOMAINPART_STATE_DOT = LOCALPART_STATE.tt(COLON);
const DOMAINPART_STATE = DOMAINPART_STATE_DOT.tt(DOMAIN);
DOMAINPART_STATE.tt(DOT, DOMAINPART_STATE_DOT);
for (const token of domainpartTokens) {
DOMAINPART_STATE.tt(token, DOMAINPART_STATE);
// we are done if we have a domain
DOMAINPART_STATE.tt(token, matrixSymbol);
}

// accept repeated TLDs (e.g .org.uk) but do not accept double dots: ..
const DOMAINPART_STATE_DOT = DOMAINPART_STATE.tt(DOT);
for (const token of domainpartTokens) {
DOMAINPART_STATE_DOT.tt(token, DOMAINPART_STATE);
}
Expand Down
8 changes: 0 additions & 8 deletions test/linkify-matrix-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,6 @@ describe('linkify-matrix', () => {
const test = '' + char + 'foo:::bar.com';
const found = linkify.find(test);
expect(found).toEqual(([{
href: char + "foo",
type,
value: '' + char + 'foo',
isLink: true,
start: 0,
end: test.indexOf("::"),
},
{
href: "http://bar.com",
type: "url",
value: "bar.com",
Expand Down

0 comments on commit 5f2bc30

Please sign in to comment.