3.6.4 • Published 4 months ago

infobox-parser v3.6.4

Weekly downloads
5,259
License
MIT
Repository
github
Last release
4 months ago

NPM Version Build Status

Infobox Parser

This was originally written as a companion module for wikijs. But it can work great on it's own as well. The main function of this module is parsing wikipedia article's infobox data. The infobox source is in wikitext format and difficult to parse. This module analyzes it and outputs JSON for you.

Usage

var parseInfo = require("infobox-parser")

parseInfo(`
{{Infobox Batman
|name      = Bruce Wayne
|hero      = y
}}`);
// Outputs {
	general: {
		hero: true,
		name: 'Bruce Wayne'
	}
}

Parsing Options

/**
 * Parse Wiki Infobox Text
 * @param {string} source - Infobox source text
 * @param {Object} options - Parsing options
 * @param {boolean} [options.simplifyDataValues=true] - Only use primary data values
 * @param {boolean} [options.removeSmall=false] - Remove <small>...</small> chunks of source data
 * @param {boolean} [options.removeReferences=true] - Remove <ref>...</ref> chunks of source data
 * @returns {Object} Structured information from source text
 */
const info = parseInfo(source, options);

Support

It supports many of wikipedia features, but not all yet. If there is a feature you need it to support, but it does not. Please create an issue and I will add the functionality.

3.6.4

4 months ago

3.6.2

2 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.3

3 years ago

3.4.2

3 years ago

3.4.1

4 years ago

3.4.0

4 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago