From 19697b62081ae6ec4a4d955a9468b92b0602708d Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 6 Jul 2022 12:34:58 -0700 Subject: [PATCH 1/2] add broken baseline for linking non-wordchars AOs --- test/baselines/generated-reference/autolinking.html | 2 ++ test/baselines/sources/autolinking.html | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/test/baselines/generated-reference/autolinking.html b/test/baselines/generated-reference/autolinking.html index 2705493b..150856cd 100644 --- a/test/baselines/generated-reference/autolinking.html +++ b/test/baselines/generated-reference/autolinking.html @@ -17,6 +17,7 @@

1 Autolinking

extra spaces

Await

Variants

+

𝔽(x)

2 Autolinking 2

@@ -29,6 +30,7 @@

2 Autolinking 2

Also, no autolinks in anchors: Lowercase.

Similarly, no autolinks for [Await].

Variants like vOne and vTwo should autolink, including when capitalized as in VOne.

+
  1. Non-word-chars AOs still link when invoked, like 𝔽(x).

%Array% and %ArrayPrototype% outside of clauses is ok.

\ No newline at end of file diff --git a/test/baselines/sources/autolinking.html b/test/baselines/sources/autolinking.html index bb790600..e4c1f559 100644 --- a/test/baselines/sources/autolinking.html +++ b/test/baselines/sources/autolinking.html @@ -14,6 +14,7 @@

Autolinking

extra spaces

Await

Variants

+

𝔽(_x_)

Autolinking 2

@@ -26,5 +27,8 @@

Autolinking 2

Also, no autolinks in anchors: Lowercase.

Similarly, no autolinks for [Await].

Variants like vOne and vTwo should autolink, including when capitalized as in VOne.

+ + 1. Non-word-chars AOs still link when invoked, like 𝔽(_x_). +

%Array% and %ArrayPrototype% outside of clauses is ok.

From 719cb610160a2569023ba8786bb6610cb3074afe Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 6 Jul 2022 12:37:05 -0700 Subject: [PATCH 2/2] link non-wordchars AOs --- src/autolinker.ts | 6 +++--- test/baselines/generated-reference/autolinking.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/autolinker.ts b/src/autolinker.ts index 1e924a5a..5779ade5 100644 --- a/src/autolinker.ts +++ b/src/autolinker.ts @@ -145,11 +145,11 @@ function isCommonAbstractOp(op: string) { function lookAheadBeyond(key: string, entry: BiblioEntry) { if (isCommonAbstractOp(key)) { // must be followed by parentheses - return '\\b(?=\\()'; + return '(?=\\()'; } if (entry.type !== 'term' || /^\w/.test(key)) { - // must not be followed by `.word` or `%%` or `]]` - return '\\b(?!\\.\\w|%%|\\]\\])'; + // must not be followed by a letter, `.word`, `%%`, `]]` + return '(?!\\w|\\.\\w|%%|\\]\\])'; } return ''; } diff --git a/test/baselines/generated-reference/autolinking.html b/test/baselines/generated-reference/autolinking.html index 150856cd..f1f8fe75 100644 --- a/test/baselines/generated-reference/autolinking.html +++ b/test/baselines/generated-reference/autolinking.html @@ -30,7 +30,7 @@

2 Autolinking 2

Also, no autolinks in anchors: Lowercase.

Similarly, no autolinks for [Await].

Variants like vOne and vTwo should autolink, including when capitalized as in VOne.

-
  1. Non-word-chars AOs still link when invoked, like 𝔽(x).
+
  1. Non-word-chars AOs still link when invoked, like 𝔽(x).

%Array% and %ArrayPrototype% outside of clauses is ok.

\ No newline at end of file