Skip to content

Commit

Permalink
Replace spaces with underscores in Wikipedia section header (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
alnzrv authored Jul 2, 2024
1 parent 2cd5def commit 8fcb60d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions js/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function featurePopupContent(feature: GeoJSON.Feature) {
(wiki_lang = v.match(/^([a-zA-Z]+):(.*)$/)) &&
(wiki_page = wiki_lang[2]))
)
wiki_page = wiki_page.replace(/#.*$/, match => match.replace(/ /g, '_')); // 'Target page#Section header' -> 'Target page#Section_header'
v = `<a href="//${wiki_lang[1]}.wikipedia.org/wiki/${wiki_page}" target="_blank">${v}</a>`;
// hyperlinks for wikidata entries
if (k.match(/(^|:)wikidata$/))
Expand Down

0 comments on commit 8fcb60d

Please sign in to comment.