wtf_wikipedia
Version:
parse wikiscript into json
1,841 lines (1,771 loc) • 322 kB
JavaScript
/*! wtf_wikipedia MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch')) :
typeof define === 'function' && define.amd ? define(['isomorphic-unfetch'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.wtf = factory(global.unfetch));
})(this, (function (unfetch) { 'use strict';
/**
* Parses out the domain and title from a url
*
* @private
* @param {string} url The url that will be parsed
* @returns {{domain: string, title: string}} The domain and title of a url
*/
const parseUrl = function (url) {
let parsed = new URL(url); //eslint-disable-line
let title = parsed.pathname.replace(/^\/(wiki\/)?/, '');
title = decodeURIComponent(title);
return {
domain: parsed.host,
title: title,
}
};
/**
* capitalizes the input
* hello -> Hello
* hello there -> Hello there
*
* @private
* @param {string} [str] the string that will be capitalized
* @returns {string} the capitalized string
*/
/**
* trim whitespaces of the ends normalize 2 spaces into one and removes whitespaces before commas
*
* @private
* @param {string} [str] the string that will be processed
* @returns {string} the processed string
*/
function trim_whitespace(str) {
if (str && typeof str === 'string') {
str = str.replace(/^\s+/, '');
str = str.replace(/\s+$/, '');
str = str.replace(/ {2}/, ' ');
str = str.replace(/\s, /, ', ');
return str
}
return ''
}
/**
* determines if an variable is an array or not
*
* @private
* @param {*} x the variable that needs to be checked
* @returns {boolean} whether the variable is an array
*/
function isArray(x) {
return Object.prototype.toString.call(x) === '[object Array]'
}
/**
* determines if an variable is an object or not
*
* @private
* @param {*} x the variable that needs to be checked
* @returns {boolean} whether the variable is an object
*/
function isObject(x) {
return x && Object.prototype.toString.call(x) === '[object Object]'
}
const isInterWiki =
/(wikibooks|wikidata|wikimedia|wikinews|wikipedia|wikiquote|wikisource|wikispecies|wikiversity|wikivoyage|wiktionary|foundation|meta)\.org/;
const defaults$c = {
action: 'query',
prop: 'revisions|pageprops', // we use the 'revisions' api here, instead of the Raw api, for its CORS-rules..
rvprop: 'content|ids|timestamp',
maxlag: 5,
rvslots: 'main',
origin: '*',
format: 'json',
redirects: 'true',
};
/**
* turns a object into a query string
*
* @private
* @param {Object<string, string | number | boolean>} obj
* @returns {string} QueryString
*/
const toQueryString = function (obj) {
return Object.entries(obj)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&')
};
/**
* cleans and prepares the tile by replacing the spaces with underscores (_) and trimming the white spaces of the ends
*
* @private
* @param {string} page the title that needs cleaning
* @returns {string} the cleaned title
*/
const cleanTitle = (page) => {
return page.replace(/ /g, '_').trim()
};
/**
* generates the url for fetching the pages
*
* @private
* @param {import('.').fetchDefaults} options
* @param {Object} [parameters]
* @returns {string} the url that can be used to make the fetch
*/
const makeUrl = function (options, parameters = defaults$c) {
let params = Object.assign({}, parameters);
//default url
let apiPath = '';
//add support for third party apis
if (options.domain) {
//wikimedia is the only api that uses `/w/api` as its path. other wikis use other paths
let path = isInterWiki.test(options.domain) ? 'w/api.php' : options.path;
apiPath = `https://${options.domain}/${path}?`;
} else if (options.lang && options.wiki) {
apiPath = `https://${options.lang}.${options.wiki}.org/w/api.php?`;
} else {
return ''
}
if (!options.follow_redirects) {
delete params.redirects;
}
// the origin header and url parameters need to be the same
// if one is provided we should change both the header and the parameter
if (options.origin) {
params.origin = options.origin;
}
//support numerical ids
let title = options.title;
if (typeof title === 'number') {
//single pageId
params.pageids = title;
} else if (typeof title === 'string') {
//single page title
params.titles = cleanTitle(title);
} else if (title !== undefined && isArray(title) && typeof title[0] === 'number') {
//pageid array
params.pageids = title.filter((t) => t).join('|');
} else if (title !== undefined && isArray(title) === true && typeof title[0] === 'string') {
//title array
params.titles = title
.filter((t) => t)
.map(cleanTitle)
.join('|');
} else {
return ''
}
//make it!
return `${apiPath}${toQueryString(params)}`
};
/**
* parses the media wiki api response to something we can use
*
* the data-format from mediawiki api is nutso
*
* @private
* @param {object} data
* @param {object} [options]
* @returns {*} result
*/
const getResult = function (data, options = {}) {
// handle nothing found or no data passed
if (!data?.query?.pages || !data?.query || !data) {
return null
}
//get all the pagesIds from the result
let pages = Object.keys(data.query.pages);
// map over the pageIds to parse out all the information
return pages.map((id) => {
// get the page by pageID
let page = data.query.pages[id] || {};
// if the page is missing or not found than return null
if (page.hasOwnProperty('missing') || page.hasOwnProperty('invalid')) {
return null
}
// get the text from the object
let text = page.revisions[0]['*'];
// if the text is not found in the regular place than it is at the other place
if (!text && page.revisions[0].slots) {
text = page.revisions[0].slots.main['*'];
}
let revisionID = page.revisions[0].revid;
let timestamp = page.revisions[0].timestamp;
page.pageprops = page.pageprops || {};
let domain = options.domain;
if (!domain && options.wiki) {
domain = `${options.wiki}.org`;
}
let meta = Object.assign({}, options, {
title: page.title,
pageID: page.pageid,
namespace: page.ns,
domain,
revisionID,
timestamp,
pageImage: page.pageprops['page_image_free'],
wikidata: page.pageprops.wikibase_item,
description: page.pageprops['wikibase-shortdesc'],
});
return { wiki: text, meta: meta }
})
};
/**
* helper for looping around all sections of a document
*
* @private
* @param {object} doc the document with the sections
* @param {string} fn the function name of the function that will be called
* @param {string | number} [clue] the clue that will be used with the function
* @returns {Array|*} the array of item at the index of the clue
*/
const sectionMap = function (doc, fn, clue) {
let arr = [];
doc.sections().forEach((sec) => {
let list = [];
if (typeof clue === 'string') {
list = sec[fn](clue);
} else {
list = sec[fn]();
}
list.forEach((t) => {
arr.push(t);
});
});
if (typeof clue === 'number') {
if (arr[clue] === undefined) {
return []
}
return [arr[clue]]
}
return arr
};
/**
* applies the the key values of defaults to options
*
* @private
* @param {object} options the user options
* @param {object} defaults the defaults
* @returns {object} the user options with the defaults applied
*/
const setDefaults = function (options, defaults) {
return Object.assign({}, defaults, options)
};
/**
* @typedef DocumentToJsonOptions
* @property {boolean | undefined} title
* @property {boolean | undefined} pageID
* @property {boolean | undefined} categories
* @property {boolean | undefined} sections
* @property {boolean | undefined} coordinates
* @property {boolean | undefined} infoboxes
* @property {boolean | undefined} images
* @property {boolean | undefined} plaintext
* @property {boolean | undefined} citations
* @property {boolean | undefined} references
*/
const defaults$b = {
title: true,
sections: true,
pageID: true,
categories: true,
wikidata: true,
description: true,
revisionID: false,
timestamp: false,
pageImage: false,
domain: false,
language: false,
};
/**
* @typedef documentToJsonReturn
* @property {string | undefined} title
* @property {number | null | undefined} pageID
* @property {string[] | undefined} categories
* @property {object[] | undefined} sections
* @property {boolean | undefined} isRedirect
* @property {object | undefined} redirectTo
* @property {object[] | undefined} coordinates
* @property {object[] | undefined} infoboxes
* @property {object[] | undefined} images
* @property {string | undefined} plaintext
* @property {object[] | undefined} references
*/
/**
* an opinionated output of the most-wanted data
*
* @private
* @param {object} doc
* @param {DocumentToJsonOptions} options
* @returns {documentToJsonReturn}
*/
const toJSON$2 = function (doc, options) {
options = setDefaults(options, defaults$b);
/**
* @type {documentToJsonReturn}
*/
let data = {};
if (options.title) {
data.title = doc.title();
}
// present only if true
if (doc.isRedirect() === true) {
data.isRedirect = true;
data.redirectTo = doc.redirectTo();
data.sections = [];
}
if (doc.isStub() === true) {
data.isStub = true;
}
if (doc.isDisambiguation() === true) {
data.isDisambiguation = true;
}
// metadata
if (options.pageID && doc.pageID()) {
data.pageID = doc.pageID();
}
if (options.wikidata && doc.wikidata()) {
data.wikidata = doc.wikidata();
}
if (options.revisionID && doc.revisionID()) {
data.revisionID = doc.revisionID();
}
if (options.timestamp && doc.timestamp()) {
data.timestamp = doc.timestamp();
}
if (options.description && doc.description()) {
data.description = doc.description();
}
// page sections
if (options.categories) {
data.categories = doc.categories();
}
if (options.sections) {
data.sections = doc.sections().map((i) => i.json(options));
}
if (options.infoboxes) {
data.infoboxes = doc.infoboxes().map((i) => i.json(options));
}
if (options.images) {
data.images = doc.images().map((i) => i.json(options));
}
if (options.citations || options.references) {
data.references = doc.references();
}
if (options.coordinates) {
data.coordinates = doc.coordinates();
}
if (options.plaintext) {
data.plaintext = doc.text(options);
}
return data
};
var _categories = [
'category', //en
'abdeeling', // pdc
'bólkur', // fo
'catagóir', // ga
'categori', // cy
'categoria',
'categoria', // co
'categoría', // es
'categorîa', // lij
'categorìa', // pms
'catégorie',
'categorie',
'catègorie', // frp
'category',
'categuria', // lmo
'catigurìa', // scn
'class', // kw
'ẹ̀ka', // yo
'flocc',
'flocc', // ang
'flokkur',
'grup', // tpi
'jamii', // sw
'kaarangay', // war
'kateggoría', // lad
'kategooria', // et
'kategori', // da
'kategorî', // ku
'kategoria', // eu
'kategória', // hu
'kategorie', //de
'kategoriija', // se
'kategorija', // sl
'kategorio', // eo
'kategoriya',
'kategoriýa', // tk
'kategoriye', // diq
'kategory', // fy
'kategorya', // tl
'kateqoriya', // az
'katiguriya', // qu
'klad', // vo
'luokka',
'ñemohenda', // gn
'roinn', //-seòrsa gd
'ronney', // gv
'rummad', // br
'setensele', // nso
'sokajy', // mg
'sumut', // atassuseq kl
'thể', // loại vi
'turkum', // uz
'категорија',
'категория', // ru
'категорія', // uk
'катэгорыя',
'төркем', // tt
'קטגוריה', // he
'تصنيف',
'تۈر', // ug
'رده',
'श्रेणी',
'श्रेणी', // hi
'বিষয়শ্রেণী', // bn
'หมวดหมู่', // th
'분류', // ko
'분류', //ko
'分类', // za
//--
];
var disambig_templates = [
'dab', //en
'disamb', //en
'disambig', //en
'disambiguation', //en
'aðgreining',
'aðgreining', //is
'aimai', //ja
'airport disambiguation',
'ałtsʼáʼáztiin', //nv
'anlam ayrımı', //gag
'anlam ayrımı', //tr
'apartigilo', //eo
'argipen', //eu
'begriepskloorenge', //stq
'begriffsklärung', //als
'begriffsklärung', //de
'begriffsklärung', //pdc
'begriffsklearung', //bar
'biology disambiguation',
'bisongidila', //kg
'bkl', //pfl
'bokokani', //ln
'caddayn', //so
'call sign disambiguation',
'caselaw disambiguation',
'chinese title disambiguation',
'clerheans', //kw
'cudakirin', //ku
'čvor', //bs
'db', //vls
'desambig', //nov
'desambigación', //an
'desambiguação', //pt
'desambiguació', //ca
'desambiguación', //es
'desambiguáncia', //ext
'desambiguasion', //lad
'desambiguassiù', //lmo
'desambigui', //lfn
'dezambiguizare', //ro
'dezanbìgua',
'dəqiqləşdirmə',
'dəqiqləşdirmə', //az
'disamb-term',
'disamb-terms',
'disamb2',
'disamb3',
'disamb4',
'disambigua', //it
'disambìgua', //sc
'disambiguasi',
'disambiguation cleanup',
'disambiguation lead name',
'disambiguation lead',
'disambiguation name',
'disambiguazion',
'disambigue',
'discretiva',
'discretiva', //la
'disheñvelout', //br
'disingkek', //min
'dixanbigua', //vec
'dixebra', //ast
'diżambigwazzjoni', //mt
'dmbox',
'doorverwijspagina', //nl
'dp', //nl
'dubbelsinnig',
'dubbelsinnig', //af
'dudalipen', //rmy
'dv', //nds_nl
'egyért', //hu
'faaleaogaina',
'fleiri týdningar', //fo
'fleirtyding', //nn
'flertydig', //da
'förgrening', //sv
'genus disambiguation',
'gì-ngiê', //cdo
'giklaro', //ceb
'gwahaniaethu', //cy
'homonimo', //io
'homónimos', //gl
'homonymie', //fr
'hospital disambiguation',
'huaʻōlelo puana like',
'huaʻōlelo puana like', //haw
'human name disambiguation cleanup',
'human name disambiguation',
'idirdhealú', //ga
'khu-pia̍t', //zh_min_nan
'kthjellim', //sq
'kujekesa', //sn
'letter-number combination disambiguation',
'letter-numbercombdisambig',
'maana', //sw
'maneo bin', //diq
'mathematical disambiguation',
'mehrdüdig begreep', //nds
'menm non', //ht
'military unit disambiguation',
'muardüüdag artiikel', //frr
'music disambiguation',
'myesakãrã',
'neibetsjuttings', //fy
'nozīmju atdalīšana', //lv
'number disambiguation',
'nuorodinis', //lt
'nyahkekaburan', //ms
'omonimeye', //wa
'omonimi',
'omonimia', //oc
'opus number disambiguation',
'page dé frouque', //nrm
'paglilinaw', //tl
'panangilawlawag', //ilo
'pansayod', //war
'pejy mitovy anarana', //mg
'peker', //no
'phonetics disambiguation',
'place name disambiguation',
'portal disambiguation',
'razdvojba', //hr
'razločitev', //sl
'razvrstavanje', //sh
'reddaghey', //gv
'road disambiguation',
'rozcestník', //cs
'rozlišovacia stránka', //sk
'school disambiguation',
'sclerir noziun', //rm
'selvendyssivu', //olo
'soilleireachadh', //gd
'species latin name abbreviation disambiguation',
'species latin name disambiguation',
'station disambiguation',
'suzmunski', //jbo
'synagogue disambiguation',
'täpsustuslehekülg', //et
'täsmennyssivu', //fi
'taxonomic authority disambiguation',
'taxonomy disambiguation',
'telplänov', //vo
'template disambiguation',
'tlahtolmelahuacatlaliztli', //nah
'trang định hướng', //vi
'ujednoznacznienie', //pl
'verdudeliking', //li
'wěcejwóznamowosć', //dsb
'wjacezmyslnosć', //hsb
'z',
'zambiguaçon', //mwl
'zeimeibu škiršona', //ltg
'αποσαφήνιση', //el
'айрық', //kk
'аҵакырацәа', //ab
'бир аайы јок',
'вишезначна одредница', //sr
'ибҳомзудоӣ', //tg
'кёб магъаналы', //krc
'күп мәгънәләр', //tt
'күп мәғәнәлелек', //ba
'массехк маӏан хилар',
'мъногосъмꙑслиѥ', //cu
'неадназначнасць', //be
'неадназначнасьць', //be_x_old
'неоднозначность', //ru
'олон удхатай', //bxr
'појаснување', //mk
'пояснение', //bg
'са шумуд манавал', //lez
'салаа утгатай', //mn
'суолталар', //sah
'текмаанисиздик', //ky
'цо магіна гуреб', //av
'чеперушка', //rue
'чолхалла', //ce
'шуко ончыктымаш-влак', //mhr
'მრავალმნიშვნელოვანი', //ka
'բազմիմաստութիւն', //hyw
'բազմիմաստություն', //hy
'באדייטן', //yi
'פירושונים', //he
'ابهامزدایی', //fa
'توضيح', //ar
'توضيح', //arz
'دقیقلشدیرمه', //azb
'ڕوونکردنەوە', //ckb
'سلجهائپ', //sd
'ضد ابہام', //ur
'گجگجی بیری', //mzn
'نامبهمېدنه', //ps
'መንታ', //am
'अस्पष्टता', //ne
'बहुअर्थी', //bh
'बहुविकल्पी शब्द', //hi
'দ্ব্যর্থতা নিরসন', //bn
'ਗੁੰਝਲ-ਖੋਲ੍ਹ', //pa
'સંદિગ્ધ શીર્ષક', //gu
'பக்கவழி நெறிப்படுத்தல்', //ta
'అయోమయ నివృత్తి', //te
'ದ್ವಂದ್ವ ನಿವಾರಣೆ', //kn
'വിവക്ഷകൾ', //ml
'වක්රෝත්ති', //si
'แก้ความกำกวม', //th
'သံတူကြောင်းကွဲ', //my
'သဵင်မိူၼ် တူၼ်ႈထႅဝ်ပႅၵ်ႇ',
'ណែនាំ', //km
'អសង្ស័យកម្ម',
'동음이의', //ko
'扤清楚', //gan
'搞清楚', //zh_yue
'曖昧さ回避', //ja
'消歧义', //zh
'釋義', //zh_classical
"gestion dj'omònim", //pms
"sut'ichana qillqa", //qu
// 'z', //vep
// 'သဵင်မိူၼ် တူၼ်ႈထႅဝ်ပႅၵ်ႇ', //shn
`gestion dj'omònim`,
`sut'ichana qillqa`,
];
// used in titles to denote disambiguation pages
// see 'Football_(disambiguation)'
var disambig_titles = [
'disambiguation', //en
'homonymie', //fr
'توضيح', //ar
'desambiguação', //pt
'Begriffsklärung', //de
'disambigua', //it
'曖昧さ回避', //ja
'消歧義', //zh
'搞清楚', //zh-yue
'значения', //ru
'ابهامزدایی', //fa
'د ابہام', //ur
'동음이의', //ko
'dubbelsinnig', //af
'այլ կիրառումներ', //hy
'ujednoznacznienie', //pl
];
var images = [
'file', //en
'image', //en
'चित्र', //img
'archivo', //es
'attēls', //lv
'berkas', //id
'bestand', //nl
'datei', //de
'dosiero', //eo
'dosya', //lad
'fájl', //hu
'fasciculus', //la
'fichier', //fr
'fil', //da
'fitxategi', //eu
'fitxer', //ca
'gambar', //su
'imagem', //pt
'imej', //ms
'immagine', //it
'larawan', //tl
'lêer', //af
'plik', //pl
'restr', //br
'slika', //bs
'wêne', //ku
'wobraz', //dsb
'выява', //be
'податотека', //mk
'слика', //sr
'файл', //ru
'სურათი', //ka
'պատկեր', //hy
'קובץ', //he
'پرونده', //fa
'دوتنه', //ps
'ملف', //ar
'وێنە', //ckb
'चित्र', //hi
'ไฟล์', //th
'파일', //ko
'ファイル', //ja
];
// https://en.m.wikipedia.org/wiki/Template:Stub#/languages
var stubs = [
'aboç',
'ahurhire',
'aizmetnis',
'amud',
'avixo de spigaso',
// 'begin',
'beginnetje',
'bibarilo',
'borrador',
'buáng-nàng-hâ',
'bun',
'buntato',
'c-supranu',
'cahrot',
'chala',
'choutchette',
'ciot',
'csonk',
'cung',
'danvez pennad',
'djermon',
'ébauche',
'ébeuche',
'ebòch',
'édéntạ',
'eginyn',
'ẹ̀kúnrẹ́rẹ́',
'en progreso',
'entamu',
'esboço',
'esborrany',
'esbòs',
'esbozo',
'ĝermo',
'gumud',
'ʻōmuku',
'junj',
'klado',
'maramara',
'mayele',
'mbegu',
'mrva',
'na mulno',
'nadabeigts rakstīņs',
'nalta',
'narcce',
'pahýl',
'pecietta',
'phí',
'pondok',
'por mejoral',
'potuʻi',
'pungol',
'qaralama',
'rabisco',
'rancangan',
'rintisan',
'saadjie',
'saha',
'sbozz',
'sid',
'síol',
'şitil',
'sjtumpke',
'skizz',
'skizze',
'škrbina',
'sơ khai',
'spire',
'stipula',
'stob',
'stobbe',
// 'stock',
'stompje',
'stub',
'stubben',
'stubbi',
'stubbur',
'stump',
'stumpen',
'stycce',
'suli',
'taslak',
'taslaq',
'tunas',
'turók',
'tynkä',
// 'u začetku',
'vangovango',
'vernuşte',
'výhonok',
'xinnoo',
'zarodk',
'zirriborroa',
'επέκταση',
'әҙерләмә',
'заготовка',
'керф',
'кечдар',
'клица',
'къæртт',
'кьурхь',
'мәкалә төпчеге',
'мъниче',
'накід',
'нєꙁаврьшєнъ члѣнъ',
'никулец',
'омоон',
'стыржень',
'хурд',
'хӏадурунжо',
'ესკიზი',
'መዋቅር',
'መዋቕር',
'अपूर्णलेखः',
'आधार',
'ठुटो',
'धाक्टें पान',
'विस्तार',
'অসম্পূর্ণ',
'পোখালি',
'સ્ટબ',
'ଅଧାଗଢ଼ା',
'குறுங்கட்டுரை',
'మొలక',
'ಎಲ್ಯ',
'ಚುಟುಕು',
'അപൂർണ്ണം',
'අංකුරය',
'โครง',
'ཆ་མི་ཚང་བ',
'អត្ថបទខ្លីមិនពេញលេញ',
'토막글',
'楔',
'芻文',
];
var infoboxes$1 = [
'infobox', //en
'amatl',
'anfo', //mwl
'anuāmapa', //haw
'bilgi kutusu', //tr
'bilgi', //tr
'bilgiquti', //uz
'boaty fampahalalana',
'boaty', //mg
'boestkelaouiñ', //br
'bosca', //ga
'capsa', //la
'diehtokássa', //se
'faktamall', //sv
'ficha', //es
'generalni', //hr
'gwybodlen3', //cy
'hộp thông tin',
'info', //pt
'infoboesse 2',
'infobokis', //tpi
'infoboks', //da
'infobox deleted',
'infobox generic',
'infobox generiek',
'infochascha', //rm
'infokašćik', //dsb
'infokast', //et
'infokutija', //bs
'infolentelė', //lt
'infookvir',
'infopolje', //sl
'informkesto', //eo
'infoschede',
'infoskreine', //ltg
'infotaula', //eu
'inligtingskas',
'inligtingskas3', //af
'inligtingskas4', //af
'kishtey fys',
'kotak info',
'kotak', //su
'məlumat qutusu',
'simple box',
'tertcita tanxe',
'tertcita', //jbo
'tiätuloová',
'tietolaatikko', //fi
'wd bosca sonraí',
'yerleşim bilgi kutusu',
'ynfoboks generyk',
'ynfoboks', //fy
'πλαίσιο πληροφοριών',
'πλαίσιο', //el
'акарточка', //ab
'аҥа', //mhr
'инфобокс', //kk
'инфокутија', //sr
'инфокутия', //bg
'інфобокс', //rue
'канадский',
'картка', //be
'карточка', //ru
'карточка2', //mdf
'карточкарус', //ba
'картуш', //koi
'қуттӣ', //tg
'ინფოდაფა', //ka
'տեղեկաքարտ', //hy
'תבנית', //he
'بطاقة', //ar
'ڄاڻخانو', //sd
'خانہ', //ur
'لغة',
'معلوٗمات ڈَبہٕ',
'ज्ञानसन्दूक', //hi
'তথ্যছক', //bn
'ਜਾਣਕਾਰੀਡੱਬਾ', //pa
'సమాచారపెట్టె', //te
'තොරතුරුකොටුව', //si
'กล่องข้อมูล', //th
'ກ່ອງຂໍ້ມູນ',
'ប្រអប់ព័ត៌មាន', //km
'정보상자', //ko
'明細', //zh_yue
];
var redirects = [
'aanstuur', //af
'aastiurey',
'adkas', //br
'ailgyfeirio',
'alidirekto',
'alih', //id
'aýdaw',
'baw-ing',
'beralîkirin', //ku
'birzuzendu',
'đổi hướng đến đây',
'doorverwijzing', //nl
'header',
'i̇stiqamətləndirmə',
'lencong', //ms
'ohjaa tänne',
'ohjaus',
'omdirigering', //no
'pāradresācija',
'patrz', //pl
'přesměrování',
'přesměruj',
'preusmeritev',
'preusmjerava',
'preusmjerenje',
'preusmjeri', //hr
'przekierowanie',
'redir',
'redirecció',
'redireccion',
'redirección', //es
'redirecionamento', //pt
'redirect', //en
'redirect3',
'redirection', //fr
'redirige aquí',
'redirige',
'redirixe equí',
'rindirizz',
'rinvia', //it
'stivre deike',
'suunamine',
'tilvísun',
'trimite',
'uudelleenohjaus',
'weiterleitung', //de
'weiterleitungshinweis',
'yoʻnaltirish',
'yönlendi̇r',
'yönlendi̇rme', //tr
'ανακατευθυνση', //el
'айдау', //kk
'багыттама',
'буссинаби',
'дӏасахьажорг',
'от пренасочване',
'перанакіраванне',
'перанакіраваньне',
'перанакіроўваецца сюды',
'перенаправление', //ru
'перенаправлення', //uk
'перенаправлено',
'пренасочување', //mk
'преусмерава ',
'преусмери', //sr
'преусмјери',
'равонакунӣ',
'ווייטערפירן', //yi
'تحويل', //ar
'تغییر_مسیر',
'تغییرمسیر', //fa
'رجوع مکرر', //ur
'رجوع_مکرر', //ur
'अनुप्रेषित', //hi
'पुनर्निर्देशन', //hi
'পুননির্দেশ', //bn
'পুনর্নির্দেশ',
'යළියොමුව',
'เปลี่ยนทาง',
'ប្តូរទីតាំងទៅ', //km
'다른 뜻 넘어옴',
'リダイレクト', //ja
'跳轉',
'転送', //ja
'重定向', //zh
];
var references = [
'references',
'reference',
'einzelnachweise',
'referencias',
'références',
'notes et références',
'脚注',
'referenser',
'bronnen',
'примечания',
];
//alt disambig-templates en-wikipedia uses
let d = ' disambiguation';
const templates$d = [
'dab',
'dab',
'disamb',
'disambig',
'geodis',
'hndis',
'setindex',
'ship index',
'split dab',
'sport index',
'wp disambig',
'disambiguation cleanup',
'airport' + d,
'biology' + d,
'call sign' + d,
'caselaw' + d,
'chinese title' + d,
'genus' + d,
'hospital' + d,
'lake index',
'letter' + d,
'letter-number combination' + d,
'mathematical' + d,
'military unit' + d,
'mountainindex',
'number' + d,
'phonetics' + d,
'place name' + d,
'portal' + d,
'road' + d,
'school' + d,
'species latin name abbreviation' + d,
'species latin name' + d,
'station' + d,
'synagogue' + d,
'taxonomic authority' + d,
'taxonomy' + d,
].reduce((h, str) => {
h[str] = true;
return h
}, {});
const mayAlsoReg = /. may (also )?refer to\b/i;
// templates that signal page is not a disambiguation
const notDisambig = {
about: true,
for: true,
'for multi': true,
'other people': true,
'other uses of': true,
'distinguish': true
};
const inTitle = new RegExp('. \\((' + disambig_titles.join('|') + ')\\)$', 'i');
const i18n_templates = disambig_templates.reduce((h, str) => {
h[str] = true;
return h
}, {});
// look for '... may refer to'
const byText = function (s) {
if (!s) {
return false
}
let txt = s.text();
if (txt !== null && txt[0]) {
if (mayAlsoReg.test(txt) === true) {
return true
}
}
return false
};
/**
* Parses the wikitext to find out if this page is a disambiguation
*
* @private
* @param {object} doc the document that is examined
* @returns {boolean} an indication if the document is a disambiguation page
*/
const isDisambig = function (doc) {
// check for a {{disambig}} template
let templates = doc.templates().map((tmpl) => tmpl.json());
let found = templates.find((obj) => {
return templates$d.hasOwnProperty(obj.template) || i18n_templates.hasOwnProperty(obj.template)
});
if (found) {
return true
}
// check for (disambiguation) in title
let title = doc.title();
if (title && inTitle.test(title) === true) {
return true
}
// does it have a non-disambig template?
let notDisamb = templates.find((obj) => notDisambig.hasOwnProperty(obj.template));
if (notDisamb) {
return false
}
//try 'may refer to' on first line for en-wiki?
if (byText(doc.sentence(0)) === true || byText(doc.sentence(1)) === true) {
return true
}
return false
};
let allStubs = new Set(stubs);
const isStub = function (doc) {
// check for a {{disambig}} template
let templates = doc.templates().map((tmpl) => tmpl.json());
return templates.some((t) => {
let name = t.template || '';
// try i18n templates like 'stubo'
if (allStubs.has(name)) {
return true
}
// english forms
if (name === 'stub' || name.endsWith('-stub')) {
return true
}
// look for i18n in last-word, like {{foo-stubo}}
let words = name.split(/[- ]/);
if (words.length > 1) {
let word = words[words.length - 1];
if (allStubs.has(word)) {
return true
}
}
return false
})
};
const defaults$a = {
caption: true,
alt: true,
links: true,
thumb: true,
url: true,
};
//
const toJson$3 = function (img, options) {
options = setDefaults(options, defaults$a);
let json = {
file: img.file(),
};
if (options.thumb !== false) {
json.thumb = img.thumbnail();
}
if (options.url !== false) {
json.url = img.url();
}
//add captions
if (options.caption !== false && img.data.caption) {
json.caption = img.caption();
if (options.links !== false && img.data.caption.links()) {
json.links = img.links();
}
}
if (options.alt !== false && img.data.alt) {
json.alt = img.alt();
}
return json
};
const server = 'wikipedia.org';
const encodeTitle = function (file) {
let title = file.replace(/^(image|file?):/i, '');
//titlecase it
title = title.charAt(0).toUpperCase() + title.substring(1);
//spaces to underscores
title = title.trim().replace(/ /g, '_');
return title
};
//the wikimedia image url is a little silly:
const makeSrc = function (file) {
let title = encodeTitle(file);
title = encodeURIComponent(title);
return title
};
//the class for our image generation functions
const Image = function (data) {
Object.defineProperty(this, 'data', {
enumerable: false,
value: data,
});
};
const methods$8 = {
file() {
let file = this.data.file || '';
if (file) {
const regFile = /^(image|file):/i;
if (!regFile.test(file)) {// if there's no 'File:', add it
file = `File:${file}`;
}
file = file.trim();
//titlecase it
file = file.charAt(0).toUpperCase() + file.substring(1);
//spaces to underscores
file = file.replace(/ /g, '_');
}
return file
},
alt() {
let str = this.data.alt || this.data.file || '';
str = str.replace(/^(file|image):/i, '');
str = str.replace(/\.(jpg|jpeg|png|gif|svg)/i, '');
return str.replace(/_/g, ' ')
},
caption() {
if (this.data.caption) {
return this.data.caption.text()
}
return ''
},
links() {
if (this.data.caption) {
return this.data.caption.links()
}
return []
},
url() {
// let lang = 'en' //this.language() || 'en' //hmm: get actual language?
let fileName = makeSrc(this.file());
let domain = this.data.domain || server;
let path = `wiki/Special:Redirect/file`;
return `https://${domain}/${path}/${fileName}`
},
thumbnail(size) {
size = size || 300;
return this.url() + '?width=' + size
},
format() {
let arr = this.file().split('.');
if (arr[arr.length - 1]) {
return arr[arr.length - 1].toLowerCase()
}
return null
},
json: function (options) {
options = options || {};
return toJson$3(this, options)
},
text: function () {
return ''
},
wikitext: function () {
return this.data.wiki || ''
},
};
Object.keys(methods$8).forEach((k) => {
Image.prototype[k] = methods$8[k];
});
Image.prototype.src = Image.prototype.url;
Image.prototype.thumb = Image.prototype.thumbnail;
var languages = {
aa: 'Afar', //Afar
ab: 'Аҧсуа', //Abkhazian
af: 'Afrikaans', //Afrikaans
ak: 'Akana', //Akan
als: 'Alemannisch', //Alemannic
am: 'አማርኛ', //Amharic
an: 'Aragonés', //Aragonese
ang: 'Englisc', //Anglo-Saxon
ar: 'العربية', //Arabic
arc: 'ܣܘܪܬ', //Aramaic
as: 'অসমীয়া', //Assamese
ast: 'Asturianu', //Asturian
av: 'Авар', //Avar
ay: 'Aymar', //Aymara
az: 'Azərbaycanca', //Azerbaijani
ba: 'Башҡорт', //Bashkir
bar: 'Boarisch', //Bavarian
'bat-smg': 'Žemaitėška', //Samogitian
bcl: 'Bikol', //Bikol
be: 'Беларуская', //Belarusian
'be-x-old': 'ltr', //Belarusian
bg: 'Български', //Bulgarian
bh: 'भोजपुरी', //Bihari
bi: 'Bislama', //Bislama
bm: 'Bamanankan', //Bambara
bn: 'বাংলা', //Bengali
bo: 'བོད་ཡིག', //Tibetan
bpy: 'ltr', //Bishnupriya
br: 'Brezhoneg', //Breton
bs: 'Bosanski', //Bosnian
bug: 'ᨅᨔ', //Buginese
bxr: 'ltr', //Buriat
ca: 'Català', //Catalan
cdo: 'Chinese', //Min
ce: 'Нохчийн', //Chechen
ceb: 'Sinugboanong', //Cebuano
ch: 'Chamoru', //Chamorro
cho: 'Choctaw', //Choctaw
chr: 'ᏣᎳᎩ', //Cherokee
chy: 'Tsetsêhestâhese', //Cheyenne
co: 'Corsu', //Corsican
cr: 'Nehiyaw', //Cree
cs: 'Česky', //Czech
csb: 'Kaszëbsczi', //Kashubian
cu: 'Slavonic', //Old
cv: 'Чăваш', //Chuvash
cy: 'Cymraeg', //Welsh
da: 'Dansk', //Danish
de: 'Deutsch', //German
diq: 'Zazaki', //Dimli
dsb: 'ltr', //Lower
dv: 'ދިވެހިބަސް', //Divehi
dz: 'ཇོང་ཁ', //Dzongkha
ee: 'Ɛʋɛ', //Ewe
far: 'فارسی', //Farsi
el: 'Ελληνικά', //Greek
en: 'English', //English
eo: 'Esperanto', //Esperanto
es: 'Español', //Spanish
et: 'Eesti', //Estonian
eu: 'Euskara', //Basque
ext: 'Estremeñu', //Extremaduran
ff: 'Fulfulde', //Peul
fi: 'Suomi', //Finnish
'fiu-vro': 'Võro', //Võro
fj: 'Na', //Fijian
fo: 'Føroyskt', //Faroese
fr: 'Français', //French
frp: 'Arpitan', //Arpitan
fur: 'Furlan', //Friulian
fy: 'ltr', //West
ga: 'Gaeilge', //Irish
gan: 'ltr', //Gan
gd: 'ltr', //Scottish
gil: 'Taetae', //Gilbertese
gl: 'Galego', //Galician
gn: "Avañe'ẽ", //Guarani
got: 'gutisk', //Gothic
gu: 'ગુજરાતી', //Gujarati
gv: 'Gaelg', //Manx
ha: 'هَوُسَ', //Hausa
hak: 'ltr', //Hakka
haw: 'Hawai`i', //Hawaiian
he: 'עברית', //Hebrew
hi: 'हिन्दी', //Hindi
ho: 'ltr', //Hiri
hr: 'Hrvatski', //Croatian
ht: 'Krèyol', //Haitian
hu: 'Magyar', //Hungarian
hy: 'Հայերեն', //Armenian
hz: 'Otsiherero', //Herero
ia: 'Interlingua', //Interlingua
id: 'Bahasa', //Indonesian
ie: 'Interlingue', //Interlingue
ig: 'Igbo', //Igbo
ii: 'ltr', //Sichuan
ik: 'Iñupiak', //Inupiak
ilo: 'Ilokano', //Ilokano
io: 'Ido', //Ido
is: 'Íslenska', //Icelandic
it: 'Italiano', //Italian
iu: 'ᐃᓄᒃᑎᑐᑦ', //Inuktitut
ja: '日本語', //Japanese
jbo: 'Lojban', //Lojban
jv: 'Basa', //Javanese
ka: 'ქართული', //Georgian
kg: 'KiKongo', //Kongo
ki: 'Gĩkũyũ', //Kikuyu
kj: 'Kuanyama', //Kuanyama
kk: 'Қазақша', //Kazakh
kl: 'Kalaallisut', //Greenlandic
km: 'ភាសាខ្មែរ', //Cambodian
kn: 'ಕನ್ನಡ', //Kannada
khw: 'کھوار', //Khowar
ko: '한국어', //Korean
kr: 'Kanuri', //Kanuri
ks: 'कश्मीरी', //Kashmiri
ksh: 'Ripoarisch', //Ripuarian
ku: 'Kurdî', //Kurdish
kv: 'Коми', //Komi
kw: 'Kernewek', //Cornish
ky: 'Kırgızca', //Kirghiz
la: 'Latina', //Latin
lad: 'Dzhudezmo', //Ladino
lan: 'Leb', //Lango
lb: 'Lëtzebuergesch', //Luxembourgish
lg: 'Luganda', //Ganda
li: 'Limburgs', //Limburgian
lij: 'Líguru', //Ligurian
lmo: 'Lumbaart', //Lombard
ln: 'Lingála', //Lingala
lo: 'ລາວ', //Laotian
lt: 'Lietuvių', //Lithuanian
lv: 'Latviešu', //Latvian
'map-bms': 'Basa', //Banyumasan
mg: 'Malagasy', //Malagasy
man: '官話', //Mandarin
mh: 'Kajin', //Marshallese
mi: 'Māori', //Maori
min: 'Minangkabau', //Minangkabau
mk: 'Македонски', //Macedonian
ml: 'മലയാളം', //Malayalam
mn: 'Монгол', //Mongolian
mo: 'Moldovenească', //Moldovan
mr: 'मराठी', //Marathi
ms: 'Bahasa', //Malay
mt: 'bil-Malti', //Maltese
mus: 'Muskogee', //Creek
my: 'Myanmasa', //Burmese
na: 'Dorerin', //Nauruan
nah: 'Nahuatl', //Nahuatl
nap: 'Nnapulitano', //Neapolitan
nd: 'ltr', //North
nds: 'Plattdüütsch', //Low German
'nds-nl': 'Saxon', //Dutch
ne: 'नेपाली', //Nepali
new: 'नेपालभाषा', //Newar
ng: 'Oshiwambo', //Ndonga
nl: 'Nederlands', //Dutch
nn: 'ltr', //Norwegian
no: 'Norsk', //Norwegian
nr: 'ltr', //South
nso: 'ltr', //Northern
nrm: 'Nouormand', //Norman
nv: 'Diné', //Navajo
ny: 'Chi-Chewa', //Chichewa
oc: 'Occitan', //Occitan
oj: 'ᐊᓂᔑᓈᐯᒧᐎᓐ', //Ojibwa
om: 'Oromoo', //Oromo
or: 'ଓଡ଼ିଆ', //Oriya
os: 'Иронау', //Ossetian
pa: 'ਪੰਜਾਬੀ', //Panjabi
pag: 'Pangasinan', //Pangasinan
pam: 'Kapampangan', //Kapampangan
pap: 'Papiamentu', //Papiamentu
pdc: 'ltr', //Pennsylvania
pi: 'Pāli', //Pali
pih: 'Norfuk', //Norfolk
pl: 'Polski', //Polish
pms: 'Piemontèis', //Piedmontese
ps: 'پښتو', //Pashto
pt: 'Português', //Portuguese
qu: 'Runa', //Quechua
rm: 'ltr', //Raeto
rmy: 'Romani', //Romani
rn: 'Kirundi', //Kirundi
ro: 'Română', //Romanian
'roa-rup': 'Armâneashti', //Aromanian
ru: 'Русский', //Russian
rw: 'Kinyarwandi', //Rwandi
sa: 'संस्कृतम्', //Sanskrit
sc: 'Sardu', //Sardinian
scn: 'Sicilianu', //Sicilian
sco: 'Scots', //Scots
sd: 'सिनधि', //Sindhi
se: 'ltr', //Northern
sg: 'Sängö', //Sango
sh: 'Srpskohrvatski', //Serbo-Croatian
si: 'සිංහල', //Sinhalese
simple: 'ltr', //Simple
sk: 'Slovenčina', //Slovak
sl: 'Slovenščina', //Slovenian
sm: 'Gagana', //Samoan
sn: 'chiShona', //Shona
so: 'Soomaaliga', //Somalia
sq: 'Shqip', //Albanian
sr: 'Српски', //Serbian
ss: 'SiSwati', //Swati
st: 'ltr', //Southern
su: 'Basa', //Sundanese
sv: 'Svenska', //Swedish
sw: 'Kiswahili', //Swahili
ta: 'தமிழ்', //Tamil
te: 'తెలుగు', //Telugu
tet: 'Tetun', //Tetum
tg: 'Тоҷикӣ', //Tajik
th: 'ไทย', //Thai
ti: 'ትግርኛ', //Tigrinya
tk: 'Туркмен', //Turkmen
tl: 'Tagalog', //Tagalog
tlh: 'tlhIngan-Hol', //Klingon
tn: 'Setswana', //Tswana
to: 'Lea', //Tonga
tpi: 'ltr', //Tok
tr: 'Türkçe', //Turkish
ts: 'Xitsonga', //Tsonga
tt: 'Tatarça', //Tatar
tum: 'chiTumbuka', //Tumbuka
tw: 'Twi', //Twi
ty: 'Reo', //Tahitian
udm: 'Удмурт', //Udmurt
ug: 'Uyƣurqə', //Uyghur
uk: 'Українська', //Ukrainian
ur: 'اردو', //Urdu
uz: 'Ўзбек', //Uzbek
ve: 'Tshivenḓa', //Venda
vi: 'Việtnam', //Vietnamese
vec: 'Vèneto', //Venetian
vls: 'ltr', //West
vo: 'Volapük', //Volapük
wa: 'Walon', //Walloon
war: 'Winaray', //Waray-Waray
wo: 'Wollof', //Wolof
xal: 'Хальмг', //Kalmyk
xh: 'isiXhosa', //Xhosa
yi: 'ייִדיש', //Yiddish
yo: 'Yorùbá', //Yoruba
za: 'Cuengh', //Zhuang
zh: '中文', //Chinese
'zh-classical': 'ltr', //Classical
'zh-min-nan': 'Bân-lâm-gú', //Minnan
'zh-yue': '粵語', //Cantonese
zu: 'isiZulu', //Zulu
};
const wp = '.wikipedia.org/wiki/$1';
const wm = '.wikimedia.org/wiki/$1';
const w = 'www.';
var wikis = {
acronym: w + 'acronymfinder.com/$1.html',
advisory: 'advisory' + wm,
advogato: w + 'advogato.org/$1',
aew: 'wiki.arabeyes.org/$1',
appropedia: w + 'appropedia.org/$1',
aquariumwiki: w + 'theaquariumwiki.com/$1',
arborwiki: 'localwiki.org/ann-arbor/$1',
arxiv: 'arxiv.org/abs/$1',
atmwiki: w + 'otterstedt.de/wiki/index.php/$1',
baden: w + 'stadtwiki-baden-baden.de/wiki/$1/',
battlestarwiki: 'en.battlestarwiki.org/wiki/$1',
bcnbio: 'historiapolitica.bcn.cl/resenas_parlamentarias/wiki/$1',
beacha: w + 'beachapedia.org/$1',
betawiki: 'translatewiki.net/wiki/$1',
bibcode: 'adsabs.harvard.edu/abs/$1',
bibliowiki: 'wikilivres.org/wiki/$1',
bluwiki: 'bluwiki.com/go/$1',
blw: 'britainloves' + wp,
botwiki: 'botwiki.sno.cc/wiki/$1',
boxrec: w + 'boxrec.com/media/index.php?$1',
brickwiki: w + 'brickwiki.info/wiki/$1',
bugzilla: 'bugzilla.wikimedia.org/show_bug.cgi?id=$1',
bulba: 'bulbapedia.bulbagarden.net/wiki/$1',
c: 'commons' + wm,
c2: 'c2.com/cgi/wiki?$1',
c2find: 'c2.com/cgi/wiki?FindPage&value=$1',
cache: w + 'google.com/search?q=cache:$1',
ĉej: 'esperanto.blahus.cz/cxej/vikio/index.php/$1',
cellwiki: 'cell.wikia.com/wiki/$1',
centralwikia: 'community.wikia.com/wiki/$1',
chej: 'esperanto.blahus.cz/cxej/vikio/index.php/$1',
choralwiki: w + 'cpdl.org/wiki/index.php/$1',
citizendium: 'en.citizendium.org/wiki/$1',
ckwiss: w + 'ck-wissen.de/ckwiki/index.php?title=$1',
comixpedia: w + 'comixpedia.org/index.php?title=$1',
commons: 'commons' + wm,
communityscheme: 'community.schemewiki.org/?c=s&key=$1',
communitywiki: 'communitywiki.org/$1',
comune: 'rete.comuni-italiani.it/wiki/$1',
creativecommons: 'creativecommons.org/licenses/$1',
creativecommonswiki: 'wiki.creativecommons.org/$1',
cxej: 'esperanto.blahus.cz/cxej/vikio/index.php/$1',
dcc: w + 'dccwiki.com/$1',
dcdatabase: 'dc.wikia.com/$1',
dcma: 'christian-morgenstern.de/dcma/index.php?title=$1',
debian: 'wiki.debian.org/$1',
delicious: w + 'delicious.com/tag/$1',
devmo: 'developer.mozilla.org/en/docs/$1',
dictionary: w + 'dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',
dict: w + 'dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',
disinfopedia: 'sourcewatch.org/index.php/$1',
distributedproofreaders: w + 'pgdp.net/wiki/$1',
distributedproofreadersca: w + 'pgdpcanada.net/wiki/index.php/$1',
dmoz: 'curlie.org/$1',
dmozs: 'curlie.org/search?q=$1',
doi: 'doi.org/$1',
donate: 'donate' + wm,
doom_wiki: 'doom.wikia.com/wiki/$1',
download: 'releases.wikimedia.org/$1',
dbdump: 'dumps.wikimedia.org/$1/latest/',
dpd: 'lema.rae.es/dpd/?key=$1',
drae: 'dle.rae.es/?w=$1',
dreamhost: 'wiki.dreamhost.com/index.php/$1',
drumcorpswiki: w + 'drumcorpswiki.com/index.php/$1',
dwjwiki: w + 'suberic.net/cgi-bin/dwj/wiki.cgi?$1',
eĉei: w + 'ikso.net/cgi-bin/wiki.pl?$1',
ecoreality: w + 'EcoReality.org/wiki/$1',
ecxei: w + 'ikso.net/cgi-bin/wiki.pl?$1',
elibre: 'enciclopedia.us.es/index.php/$1',
emacswiki: w + 'emacswiki.org/emacs?$1',
encyc: 'encyc.org/wiki/$1',
energiewiki: w + 'netzwerk-energieberater.de/wiki/index.php/$1',
englyphwiki: 'en.glyphwiki.org/wiki/$1',
enkol: 'enkol.pl/$1',
eokulturcentro: 'esperanto.toulouse.free.fr/nova/wikini/wakka.php?wiki=$1',
esolang: 'esolangs.org/wiki/$1',
etherpad: 'etherpad.wikimedia.org/$1',
ethnologue: w + 'ethnologue.com/language/$1',
ethnologuefamily: w + 'ethnologue.com/show_family.asp?subid=$1',
evowiki: 'wiki.cotch.net/index.php/$1',
exotica: w + 'exotica.org.uk/wiki/$1',
fanimutationwiki: 'wiki.animutationportal.com/index.php/$1',
fedora: 'fedoraproject.org/wiki/$1',
finalfantasy: 'finalfantasy.wikia.com/wiki/$1',
finnix: w + 'finnix.org/$1',
flickruser: w + 'flickr.com/people/$1',
flickrphoto: w + 'flickr.com/photo.gne?id=$1',
floralwiki: w + 'floralwiki.co.uk/wiki/$1',
foldoc: 'foldoc.org/$1',
foundation: 'foundation' + wm,
foundationsite: 'wikimediafoundation.org/$1',
foxwiki: 'fox.wikis.com/wc.dll?Wiki~$1',
freebio: 'freebiology.org/wiki/$1',
freebsdman: w + 'FreeBSD.org/cgi/man.cgi?apropos=1&query=$1',
freeculturewiki: 'wiki.freeculture.org/index.php/$1',
freedomdefined: 'freedomdefined.org/$1',
freefeel: 'freefeel.org/wiki/$1',
freekiwiki: 'wiki.freegeek.org/index.php/$1',
// freenode: 'irc://irc.freenode.net/$1',
freesoft: 'directory.fsf.org/wiki/$1',
ganfyd: 'ganfyd.org/index.php?title=$1',
gardenology: w + 'gardenology.org/wiki/$1',
gausswiki: 'gauss.ffii.org/$1',
gentoo: 'wiki.gentoo.org/wiki/$1',
genwiki: 'wiki.genealogy.net/index.php/$1',
gerrit: 'gerrit.wikimedia.org/r/$1',
git: 'gerrit.wikimedia.org/g/$1',
google: w + 'google.com/search?q=$1',
googledefine: w + 'google.com/search?q=define:$1',
googlegroups: 'groups.google.com/groups?q=$1',
guildwarswiki: 'wiki.guildwars.com/wiki/$1',
guildwiki: 'guildwars.wikia.com/wiki/$1',
guc: 'tools.wmflabs.org/guc/?user=$1',
gucprefix: 'tools.wmflabs.org/guc/?isPrefixPattern=1&src=rc&user=$1',
gutenberg: w + 'gutenberg.org/etext/$1',
gutenbergwiki: w + 'gutenberg.org/wiki/$1',
hackerspaces: 'hackerspaces.org/wiki/$1',
h2wiki: 'halowiki.net/p/$1',
hammondwiki: w + 'dairiki.org/HammondWiki/index.php3?$1',
hdl: 'hdl.handle.net/$1',
heraldik: 'heraldik-wiki.de/wiki/$1',
heroeswiki: 'heroeswiki.com/$1',
horizonlabs: 'horizon.wikimedia.org/$1',
hrwiki: w + 'hrwiki.org/index.php/$1',
hrfwiki: 'fanstuff.hrwiki.org/index.php/$1',
hupwiki: 'wiki.hup.hu/index.php/$1',
iarchive: 'archive.org/details/$1',
imdbname: w + 'imdb.com/name/nm$1/',
imdbtitle: w + 'imdb.com/title/tt$1/',
imdbcompany: w + 'imdb.com/company/co$1/',
imdbcharacter: w + 'imdb.com/character/ch$1/',
incubator: 'incubator' + wm,
infosecpedia: 'infosecpedia.org/wiki/$1',
infosphere: 'theinfosphere.org/$1',
// irc: 'irc://irc.freenode.net/$1',
// ircs: 'ircs://irc.freenode.net/$1',
// ircrc: 'irc://irc.wikimedia.org/$1',
// rcirc: 'irc://irc.wikimedia.org/$1',
'iso639-3': 'iso639-3.sil.org/code/$1',
issn: w + 'worldcat.org/issn/$1',
iuridictum: 'iuridictum.pecina.cz/w/$1',
jaglyphwiki: 'glyphwiki.org/wiki/$1',
jefo: 'esperanto-jeunes.org/wiki/$1',
jerseydatabase: 'jerseydatabase.com/wiki.php?id=$1',
jira: 'jira.toolserver.org/browse/$1',
jspwiki: w + 'ecyrd.com/JSPWiki/Wiki.jsp?page=$1',
jstor: w + 'jstor.org/journals/$1',
kamelo: 'kamelopedia.mormo.org/index.php/$1',
karlsruhe: 'ka.stadtwiki.net/$1',
kinowiki: 'kino.skripov.com/index.php/$1',
komicawiki: 'wiki.komica.org/?$1',
kontuwiki: 'kontu.wiki/$1',
wikitech: 'wikitech' + wm,
libreplanet: 'libreplanet.org/wiki/$1',
linguistlist: 'linguistlist.org/forms/langs/LLDescription.cfm?code=$1',
linuxwiki: w + 'linuxwiki.de/$1',
linuxwikide: w + 'linuxwiki.de/$1',
liswiki: 'liswiki.org/wiki/$1',
literateprograms: 'en.literateprograms.org/$1',
livepedia: w + 'livepedia.gr/index.php?title=$1',
localwiki: 'localwiki.org/$1',
lojban: 'mw.lojban.org/papri/$1',
lostpedia: 'lostpedia.wikia.com/wiki/$1',
lqwiki: 'wiki.linuxquestions.org/wiki/$1',
luxo: 'tools.wmflabs.org/guc/?user=$1',
mail: 'lists.wikimedia.org/mailman/listinfo/$1',
mailarchive: 'lists.wikimedia.org/pipermail/$1',
mariowiki: w + 'mariowiki.com/$1',
marveldatabase: w + 'marveldatabase.com/wiki/index.php/$1',
meatball: 'meatballwiki.org/wiki/$1',
mw: w + 'mediawiki.org/wiki/$1',
mediazilla: 'bugzilla.wikimedia.org/$1',
memoryalpha: 'memory-alpha.fandom.com/wiki/$1',
metawiki: 'meta' + wm,
metawikimedia: 'meta' + wm,
metawikipedia: 'meta' + wm,
mineralienatlas: w + 'mineralienatlas.de/lexikon/index.php/$1',
moinmoin: 'moinmo.in/$1',
monstropedia: w + 'monstropedia.org/?title=$1',
mosapedia: 'mosapedia.de/wiki/index.php/$1',
mozcom: 'mozilla.wikia.com/wiki/$1',
mozillawiki: 'wiki.mozilla.org/$1',
mozillazinekb: 'kb.mozillazine.org/$1',
musicbrainz: 'musicbrainz.org/doc/$1',
mediawikiwiki: w + 'mediawiki.org/wiki/$1',
mwod: w + 'merriam-webster.com/dictionary/$1',
mwot: w + 'merriam-webster.com/thesaurus/$1',
nkcells: w + 'nkcells.info/index.php?title=$1',
nara: 'catalog.archives.gov/id/$1',
nosmoke: 'no-smok.net/nsmk/$1',
nost: 'nostalgia' + wp,
nostalgia: 'nostalgia' + wp,
oeis: 'oeis.org/$1',
oldwikisource: 'wikisource.org/wiki/$1',
olpc: 'wiki.laptop.org/go/$1',
omegawiki: w + 'omegawiki.org/Expression:$1',
onelook: w + 'onelook.com/?ls=b&w=$1',
openlibrary: 'openlibrary.org/$1',
openstreetmap: 'wiki.openstreetmap.org/wiki/$1',
openwetware: 'openwetware.org/wiki/$1',
opera7wiki: 'operawiki.info/$1',
organicdesign: w + 'organicdesign.co.nz/$1',
orthodoxwiki: 'orthodoxwiki.org/$1',
osmwiki: 'wiki.openstreetmap.org/wiki/$1',
otrs: 'ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=$1',
otrswiki: 'otrs-wiki' + wm,
ourmedia: w + 'socialtext.net/ourmedia/index.cgi?$1',
outreach: 'outreach' + wm,
outreachwiki: 'outreach' + wm,
owasp: w + 'owasp.org/index.php/$1',
panawiki: 'wiki.alairelibre.net/index.php?title=$1',
patwiki: 'gauss.ffii.org/$1',
personaltelco: 'personaltelco.net/wiki/$1',
petscan: 'petscan.wmflabs.org/?psid=$1',
phab: 'phabricator.wikimedia.org/$1',
phabricator: 'phabricator.wikimedia.org/$1',
phwiki: w + 'pocketheaven.com/ph/wiki/index.php?title=$1',
phpwiki: 'phpwiki.sourceforge.net/phpwiki/index.php?$1',
planetmath: 'planetmath.org/node/$1',
pmeg: w + 'bertilow.com/pmeg/$1',
pmid: w + 'ncbi.nlm.nih.gov/pubmed/$1?dopt=Abstract',
pokewiki: 'pokewiki.de/$1',
pokéwiki: 'pokewiki