Changeset 17735 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-04-09T23:02:40+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r17627 r17735 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Objects; 16 17 import java.util.Optional; 17 18 import java.util.function.Supplier; … … 160 161 161 162 // Common 162 final String validURL = value.startsWith("http:") || value.startsWith("https:") 163 ? value 164 : value.startsWith("www.") 165 ? "http://" + value 166 : null; 167 if (key.matches("^(.+[:_])?website([:_].+)?$") && validURL != null) { 168 linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get()); 169 } 170 if (key.matches("^(.+[:_])?source([:_].+)?$") && validURL != null) { 171 linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get()); 172 } 173 if (key.matches("^(.+[:_])?url([:_].+)?$") && validURL != null) { 174 linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get()); 175 } 176 if (key.matches("image") && validURL != null) { 177 linkConsumer.acceptLink(tr("View image"), validURL, imageResource.get()); 163 final List<String> validURLs = value.startsWith("http:") || value.startsWith("https:") || value.startsWith("www.") 164 ? OsmUtils.splitMultipleValues(value) 165 .map(v -> v.startsWith("http:") || v.startsWith("https:") 166 ? v 167 : v.startsWith("www.") 168 ? "http://" + v 169 : null) 170 .filter(Objects::nonNull) 171 .collect(Collectors.toList()) 172 : Collections.emptyList(); 173 if (key.matches("^(.+[:_])?website([:_].+)?$") && !validURLs.isEmpty()) { 174 validURLs.forEach(validURL -> linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get())); 175 } 176 if (key.matches("^(.+[:_])?source([:_].+)?$") && !validURLs.isEmpty()) { 177 validURLs.forEach(validURL -> linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get())); 178 } 179 if (key.matches("^(.+[:_])?url([:_].+)?$") && !validURLs.isEmpty()) { 180 validURLs.forEach(validURL -> linkConsumer.acceptLink(getLinkName(validURL, key), validURL, imageResource.get())); 181 } 182 if (key.matches("image") && !validURLs.isEmpty()) { 183 validURLs.forEach(validURL -> linkConsumer.acceptLink(tr("View image"), validURL, imageResource.get())); 178 184 } 179 185
Note:
See TracChangeset
for help on using the changeset viewer.