spencermountain / wtf_wikipedia

a pretty-committed wikipedia markup parser
https://observablehq.com/@spencermountain/wtf_wikipedia
MIT License
779 stars 129 forks source link

use siteInfo instead of hard code protocol and interwiki #276

Open dan1wang opened 5 years ago

dan1wang commented 5 years ago

related to issue #275

In wtf_wikipedia.js, interwikis and site_map can be retrieved from site info .query.interwikimap

The regexp /\[(https?|news|ftp|mailto|gopher|irc):\/\/[^\]\| ]{4,1500}([\| ].*?)?\]/ is used multiple times. It should be a constant. The allowed protocols can be retrieved from site info.query.protocols

spencermountain commented 5 years ago

if you wanted to move the protocol regexp, pr's welcome