| 3 | | If the goal is to get the right value->URL formatter in tag2link, the easiest is to follow the same scheme as what iD does (see [https://github.com/openstreetmap/iD/blob/189a3f87e389f9c2745a9c25b98ec0e4823776dc/modules/services/osm_wikibase.js#L183 code]). Steps: |
| 4 | | 1. convert key to a "sitelink": `("Key:" + key).replace('_', ' ')` (replace underscores with spaces) |
| 5 | | 1. call `www.osm.org/w/api.php?action=wbgetentities&...` to get the data items for each of the sitelinks. You should pass all sitelinks to it in a single call, rather than calling it multiple times. See above code link. |
| | 3 | If the goal is to get the right value->URL formatter in tag2link, the easiest is to follow the same scheme as what iD does: |
| | 4 | 1. convert key to a "sitelink": `("Key:" + key).replace('_', ' ')` (replace underscores with spaces). See [https://github.com/openstreetmap/iD/blob/189a3f87e389f9c2745a9c25b98ec0e4823776dc/modules/services/osm_wikibase.js#L116 iD code]. |
| | 5 | 1. call `www.osm.org/w/api.php?action=wbgetentities&...` to get the data items for each of the sitelinks. You should pass all sitelinks to it in a single call, rather than calling it multiple times. See [https://github.com/openstreetmap/iD/blob/189a3f87e389f9c2745a9c25b98ec0e4823776dc/modules/services/osm_wikibase.js#L183 iD code]. |