Skip to content

Commit

Permalink
In notes, shortcut URL to element to osm.org/way/... #1178
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Sep 3, 2018
1 parent 96fbcec commit 58aa017
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private static String getAssociatedElementRegex(CreateNote n)
// before 0.11 - i.e. "way #123"
String oldStyleRegex = elementType+"\\s*#"+n.elementId;
// i.e. www.openstreetmap.org/way/123
String newStyleRegex = "openstreetmap\\.org\\/"+elementType+"\\/"+n.elementId;
String newStyleRegex = "(osm|openstreetmap)\\.org\\/"+elementType+"\\/"+n.elementId;
// i: turns on case insensitive regex, s: newlines are also captured with "."
return "(?is).*(("+oldStyleRegex+")|("+newStyleRegex+")).*";
}
Expand All @@ -247,6 +247,6 @@ static String getAssociatedElementString(CreateNote n)
if(!n.hasAssociatedElement()) return null;

String elementName = n.elementType.name().toLowerCase(Locale.UK);
return "https://www.openstreetmap.org/" + elementName + "/" + n.elementId;
return "https://osm.org/" + elementName + "/" + n.elementId;
}
}

0 comments on commit 58aa017

Please sign in to comment.