- Timestamp:
- 2020-02-17T21:18:03+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r15861 r15881 10 10 import java.net.URL; 11 11 import java.nio.charset.StandardCharsets; 12 import java.util.Collections; 13 import java.util.Map; 14 import java.util.function.UnaryOperator; 12 15 import java.util.regex.Matcher; 13 16 import java.util.regex.Pattern; … … 46 49 static final MultiMap<String, String> wikidataRules = new MultiMap<>(); 47 50 51 static final Map<String, UnaryOperator<String>> valueFormatter = Collections.singletonMap( 52 "ref:bag", v -> String.format("%16s", v).replace(' ', '0') 53 ); 54 48 55 static final String languagePattern = LanguageInfo.getLanguageCodes(null).stream() 49 56 .map(Pattern::quote) … … 179 186 180 187 wikidataRules.getValues(key).forEach(urlFormatter -> { 181 final String url = urlFormatter.replace("$1", value); 188 final String formattedValue = valueFormatter.getOrDefault(key, x -> x).apply(value); 189 final String url = urlFormatter.replace("$1", formattedValue); 182 190 linkConsumer.acceptLink(getLinkName(url, key), url); 183 191 });
Note:
See TracChangeset
for help on using the changeset viewer.