Improved geo link pattern

This commit is contained in:
M66B 2024-04-15 07:56:58 +02:00
parent c72a5194c2
commit 2baa11161d
1 changed files with 6 additions and 1 deletions

View File

@ -1543,6 +1543,8 @@ public class HtmlHelper {
static void autoLink(Document document, boolean outbound) {
// https://en.wikipedia.org/wiki/List_of_URI_schemes
// https://en.wikipedia.org/wiki/Geo_URI_scheme
// https://developers.google.com/maps/documentation/urls/android-intents
// xmpp:[<user>]@<host>[:<port>]/[<resource>][?<query>]
// geo:<lat>,<lon>[,<alt>][;u=<uncertainty>]
// tel:<phonenumber>
@ -1555,7 +1557,10 @@ public class HtmlHelper {
.replace("(?i:http|https|rtsp)://",
"(((?i:http|https)://)|((?i:xmpp):))") +
"|" +
"(?i:geo:\\d+,\\d+(,\\d+)?(;u=\\d+)?)" +
"(?i:geo:(-?\\d+(\\.\\d+)?),(-?\\d+(\\.\\d+)?)(,-?\\d+(\\.\\d+)?)?" +
"(;u=\\d+)?" + // Uncertainty
"(\\?z=\\d+)?" + // Zoom
"(\\?q=.+)?)" + // Google Maps query
"|" +
"(?i:tel:" + Patterns.PHONE.pattern() + ")" +
(BuildConfig.DEBUG ? "|(" + GPA_PATTERN + ")" : ""));