From 8377de81963b15ad806f0a4579a3d89dbcc7e7e2 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 24 Jul 2023 15:58:52 -0400 Subject: [PATCH 1/2] Don't percent encode "#" in URL's (breaks named anchors) --- M2/Macaulay2/m2/html.m2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/M2/Macaulay2/m2/html.m2 b/M2/Macaulay2/m2/html.m2 index 2a4818aabcd..d30a80b77fc 100644 --- a/M2/Macaulay2/m2/html.m2 +++ b/M2/Macaulay2/m2/html.m2 @@ -200,7 +200,8 @@ percentEncoding = new MutableHashTable from toList apply( -- unreserved characters from RFC 3986 -- ALPHA / DIGIT / "-" / "." / "_" / "~" -- we also add "/" and ":" since they're standard URL characters - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890-._~/:", + -- also "#" for named anchors + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890-._~/:#", c -> (c, c)) -- everything else will be percent encoded and added to the hash table -- as needed From 7e3cdc3e244feaba6e4a6e559f43fac5d8ad7a64 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 24 Jul 2023 16:59:32 -0400 Subject: [PATCH 2/2] Update urlEncode docs to mention that "#" isn't percent encoded --- M2/Macaulay2/packages/Macaulay2Doc/functions/urlEncode-doc.m2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/packages/Macaulay2Doc/functions/urlEncode-doc.m2 b/M2/Macaulay2/packages/Macaulay2Doc/functions/urlEncode-doc.m2 index eab65b879e4..fcdb1a600aa 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/functions/urlEncode-doc.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/functions/urlEncode-doc.m2 @@ -13,7 +13,7 @@ doc /// :String Description Text - Encode all of the characters in a URL except for "/", ":", and + Encode all of the characters in a URL except for "/", ":", "#", and the "unreserved characters" specified by @HREF{"https://www.rfc-editor.org/rfc/rfc3986.html", "RFC 3986"}@, i.e., the alphanumeric characters, "-", ".", "_", and "~", using