Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clokep/mwcomposerfromhell
Convert parsed MediaWiki wikicode (using mwparserfromhell) to HTML.
https://github.com/clokep/mwcomposerfromhell
mediawiki python wikipedia
Last synced: 4 months ago
JSON representation
Convert parsed MediaWiki wikicode (using mwparserfromhell) to HTML.
- Host: GitHub
- URL: https://github.com/clokep/mwcomposerfromhell
- Owner: clokep
- License: isc
- Created: 2018-10-24T13:55:28.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2022-12-23T20:44:06.000Z (about 2 years ago)
- Last Synced: 2024-09-28T10:23:53.057Z (4 months ago)
- Topics: mediawiki, python, wikipedia
- Language: Python
- Homepage:
- Size: 334 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
mwcomposerfromhell
##################.. image:: https://travis-ci.org/clokep/mwcomposerfromhell.svg?branch=master
:target: https://travis-ci.org/clokep/mwcomposerfromhell**mwcomposerfromhell** is a Python package that provides an easy-to-use method
to convert MediaWiki `Wikicode`_ to HTML via `mwparserfromhell`_. It supports
Python 3... _Wikicode: https://en.wikipedia.org/wiki/Help:Wikitext
.. _mwparserfromhell: https://mwparserfromhell.readthedocs.ioUsage
-----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... code-block:: python
>>> import mwparserfromhell
>>> import mwcomposerfromhell
>>> wikicode = mwparserfromhell.parse(text) # Step 1
>>> html = mwcomposerfromhell.compose(wikicode) # Step 2You 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... code-block:: sh
python -m mwcomposerfromhell path/to/my/wikicode