Skip to main content

Convert the parsed MediaWiki wikicode (using mwparserfromhell) to HTML.

Project description

https://travis-ci.org/clokep/mwcomposerfromhell.svg?branch=master

mwcomposerfromhell is a Python package that provides an easy-to-use method to convert MediaWiki Wikicode to HTML via mwparserfromhell. It supports Python 3.

Usage

Normal usage is rather straightforward to convert from a str of Wikicode to a str of HTML. It involves two steps:

  1. Parse the Wikicode to an abstract syntax tree using mwparserfromhell.

  2. Convert the AST to HTML.

>>> import mwparserfromhell
>>> import mwcomposerfromhell
>>> wikicode = mwparserfromhell.parse(text)  # Step 1
>>> html = mwcomposerfromhell.compose(wikicode)  # Step 2

You can also use it from the command line if you already have your wikicode in a file. The convert HTML is output on standard out.

python -m mwcomposerfromhell path/to/my/wikicode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mwcomposerfromhell-0.4-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file mwcomposerfromhell-0.4-py3-none-any.whl.

File metadata

  • Download URL: mwcomposerfromhell-0.4-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for mwcomposerfromhell-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4fbd68e909fbd09a739d166744842844c661eb109419593707aecd1aa5b5b7a6
MD5 1ace67abfcf093e643c0aa9fbe40475a
BLAKE2b-256 e23e8aeb1a2765ed50a678d877e1782cd2095d40c20722c3cc5db2c31638a18b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page