- Timestamp:
- 2021-04-09T23:18:01+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r17735 r17736 27 27 import javax.json.JsonValue; 28 28 29 import com.google.gdata.util.common.base.PercentEscaper; 29 30 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 30 31 import org.openstreetmap.josm.data.osm.OsmUtils; … … 202 203 if (key.matches("wikimedia_commons|image") && value.matches("(?i:File):.*")) { 203 204 OsmUtils.splitMultipleValues(value).forEach(i -> linkConsumer.acceptLink( 204 tr("View image on Wikimedia Commons"), "https://commons.wikimedia.org/wiki/" + i, imageResource.get()));205 tr("View image on Wikimedia Commons"), getWikimediaCommonsUrl(i), imageResource.get())); 205 206 } 206 207 if (key.matches("wikimedia_commons|image") && value.matches("(?i:Category):.*")) { 207 208 OsmUtils.splitMultipleValues(value).forEach(i -> linkConsumer.acceptLink( 208 tr("View category on Wikimedia Commons"), "https://commons.wikimedia.org/wiki/" + i, imageResource.get()));209 tr("View category on Wikimedia Commons"), getWikimediaCommonsUrl(i), imageResource.get())); 209 210 } 210 211 … … 216 217 } 217 218 219 private static String getWikimediaCommonsUrl(String i) { 220 return "https://commons.wikimedia.org/wiki/" + new PercentEscaper(PercentEscaper.SAFEPATHCHARS_URLENCODER, false).escape(i); 221 } 222 218 223 private static String getLinkName(String url, String fallback) { 219 224 return tr("Open {0}", getHost(url, fallback));
Note:
See TracChangeset
for help on using the changeset viewer.