How to use the mediawiki-title.Title.newFromText function in mediawiki-title

To help you get started, we’ve selected a few mediawiki-title examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / parsoid / lib / config / MWParserEnvironment.js View on Github external
MWParserEnvironment.prototype._makeTitle = function(urlDecodedText, defaultNS, noExceptions) {
	try {
		if (this.page && /^(\#|\/|\.\.\/)/.test(urlDecodedText)) {
			defaultNS = this.page.ns;
		}
		urlDecodedText = this.resolveTitle(urlDecodedText);
		return Title.newFromText(urlDecodedText, this.conf.wiki.siteInfo, defaultNS);
	} catch (e) {
		if (noExceptions) {
			return null;
		} else {
			throw e;
		}
	}
};
github wikimedia / restbase / v1 / lists.js View on Github external
return mwUtil.getSiteInfo(hyper, req, entry.project).then((siteinfo) => {
                const title = Title.newFromText(entry.title, siteinfo).getPrefixedDBKey();
                entry.summary = {
                    $merge: [
                        `${siteinfo.baseUri}/page/summary/${encodeURIComponent(title)}`
                    ]
                };
            }).catch(() => {});
        })
github wikimedia / restbase / lib / mwUtil.js View on Github external
.then((siteInfo) => {
    try {
        return Title.newFromText(title, siteInfo);
    } catch (e) {
        throw new HTTPError({
            status: 400,
            body: {
                type: 'bad_request',
                detail: e.message
            }
        });
    }
});

mediawiki-title

Title normalization library for mediawiki

Apache-2.0
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis