osmlab / changeset-map

Visualise a changeset on a map
http://osmlab.github.io/changeset-map/
ISC License
34 stars 12 forks source link

Link to Wikidata items #254

Closed Danysan1 closed 1 month ago

Danysan1 commented 2 years ago

If a tag links to Wikidata (keys like wikidata=*, subject:wikidata=*, ... described here) the changes in this pull request render the Wikidata ID[s] as link[s] to the relevant Wikidata page.


An example with a single ID is the value of wikidata=* in the node 5476661921 in http://osmlab.github.io/changeset-map/#124509834 : image Before:

<td class="diff-property cmap-scroll-styled props-diff-deleted">Q3639645</td>

After:

<td class="diff-property cmap-scroll-styled props-diff-deleted">
  <span>
    <a target="_blank" rel="noopener noreferrer" class="cmap-wikidata-link" href="https://www.wikidata.org/wiki/Q3639645">Q3639645</a>
  </span>
</td>

An example with multiple IDs is the value of name:etymology:wikidata=* in the way 1006286770 in http://osmlab.github.io/changeset-map/#114239576 : Immagine 2022-08-12 143018 Before:

<td class="diff-property cmap-scroll-styled props-diff-added">Q180350;Q232024;Q867690;Q59631</td>

After:

<td class="diff-property cmap-scroll-styled props-diff-added">
  <span>
    <a target="_blank" rel="noopener noreferrer" class="cmap-wikidata-link" href="https://www.wikidata.org/wiki/Q180350">Q180350</a>
    <span>;</span>
    <a target="_blank" rel="noopener noreferrer" class="cmap-wikidata-link" href="https://www.wikidata.org/wiki/Q232024">Q232024</a>
    <span>;</span>
    <a target="_blank" rel="noopener noreferrer" class="cmap-wikidata-link" href="https://www.wikidata.org/wiki/Q867690">Q867690</a>
    <span>;</span>
    <a target="_blank" rel="noopener noreferrer" class="cmap-wikidata-link" href="https://www.wikidata.org/wiki/Q59631">Q59631</a>
  </span>
</td>

This PR is related to https://github.com/mapbox/osmcha-frontend/issues/630

willemarcel commented 1 month ago

@Danysan1 Thanks for the PR, and sorry for the long delay on checking it.