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 Distribution

mwcomposerfromhell-0.5.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

mwcomposerfromhell-0.5-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file mwcomposerfromhell-0.5.tar.gz.

File metadata

  • Download URL: mwcomposerfromhell-0.5.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.13

File hashes

Hashes for mwcomposerfromhell-0.5.tar.gz
Algorithm Hash digest
SHA256 c73c6935dca08af729c6405058611014642090a424826f14ea20f32683282b66
MD5 5f224fa4063bf077deb89d6e3b650409
BLAKE2b-256 8b108d93025e303b36dfacea9f88a9dc45232d039ce914dbe9580458eff01158

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mwcomposerfromhell-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4125b64d82ea725085250482867498665d8aa193f471fe70c76ac9f700a278
MD5 73bb109472275055923cd2f223223111
BLAKE2b-256 bf0ebe4d4072bb774b8b980e23f152eb12bd84c2f5accd7ac747be2455bdd282

See more details on using hashes here.

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