Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mediawiki-title

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediawiki-title

Title normalization library for mediawiki

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
increased by200.99%
Maintainers
4
Weekly downloads
 
Created
Source

mediawiki-title npm version Build Status Coverage Status Dependencies

Mediawiki title normalizetion, that conforms to the normalization rules used in MediaWiki Core. In general, the page title is converted to the mediawiki DB key format by trimming spaces, replacing whitespace symbols to underscores and applying wiki-specific capitalizetion rules. The namespace name is converted to a localized canonical name.

API

  • Normalizer
    • new Normalizer(options)
    • .normalize(title, domain)P.<string>

new Normalizer(options)

Creates an instance of title normalizer.

ParamTypeDescription
optionsObjectthe normalizer options
options.apiURIfunctiona function that takes a domain string and returns back an API URI that needs to be contacted to get the site information used for normalization.

normalizer.normalize(title, domain) ⇒ P.<string>

Normalize a title according to the rules of

Kind: instance method of Normalizer
Returns: P.<string> - normalized version of a title.
Access: public

ParamTypeDescription
titlestringthe page title to normalize.
domainstringthe domain page belongs to.

Usage

The library returns a Bluebird promise of a normalized title. Wiki-specific rules are fetched from the api, and cached within the Normalizer instance, so reusing the instance is highly recommended.

var normalizer = new Normalizer({
  apiURI: function(domain) { return 'https://' + domain + '/w/api.php'; }
});

normalizer.normalize(title, 'en.wikipedia.org')
.then(function(normalizedTitle) {
  console.log(normalizedTitle);
})
.catch(function(e) {
  console.log('The title is ivalid! ' + e.message);
});

Bug reporting

For bug reporting please use Phabricator ] and mark the bugs with Servises label or contuct directly in IRC in the #wikimedia-services channel.

Keywords

FAQs

Package last updated on 26 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc