A parser for MediaWiki titles
Project description
MediaWikiTitleParser
MWTP is a parser for MediaWiki titles. Its logic is partly derived from mediawiki.Title, and hence is licensed under GNU GPL.
It works as simple as follows:
from mwtp import TitleParser as Parser
parser = Parser(namespaces_data, namespace_aliases)
title = parser.parse(' _ FoO: this/is A__/talk page _ ')
print(repr(title))
# Title('Thảo luận:This/is A /talk page')
namespaces_data
and namespace_aliases
can be obtained by
making a query to a wiki's API with
action=query&meta=siteinfo&siprop=namespaces|namespacealiases
:
namespaces_data = {
'0': { 'id': 0, 'case': 'first-letter', 'name': '', ...: ... },
'1': { 'id': 1, 'case': 'first-letter', 'name': 'Thảo luận', ...: ... },
...: ...
}
namespace_aliases = [
{ 'id': 1, 'alias': 'Foo' },
...
]
For more information, see the documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mwtp-2.3.0.tar.gz
(28.9 kB
view details)
Built Distribution
mwtp-2.3.0-py3-none-any.whl
(25.6 kB
view details)
File details
Details for the file mwtp-2.3.0.tar.gz
.
File metadata
- Download URL: mwtp-2.3.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0b4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d295db45983230fbdc89cc4ee194dd2241e3b28254b762c9828f0d5189e01fa |
|
MD5 | bc8c6e95241a850b45ad5e8b8e062480 |
|
BLAKE2b-256 | 03bdf54b6c0951f77f29de647082d1738aba98cb464c8bf84db21fd1d3b1b681 |
Provenance
File details
Details for the file mwtp-2.3.0-py3-none-any.whl
.
File metadata
- Download URL: mwtp-2.3.0-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0b4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74322c856401fd5199a87f2d5f7953bf25aa2d54cef20e6893c0c1d9eba9af0 |
|
MD5 | 5013bc43762f1cfc8128ca0bc4088f30 |
|
BLAKE2b-256 | 0a5d61a4350ce2896c702ac79f1e698d8a0a970de7e1f86ca865aaddbbb9fa5e |