Skip to main content

MoinMoin To Git (Markdown) Wiki Converter

Project description

MoinMoin To Git (Markdown) Wiki Converter

ci documentation pypi version

App to convert a MoinMoin wiki file tree into a git based wiki as used on github, gitlab or gitea.

Current Version

Version: 0.8.0

Status

This was required for a one-off conversion. I'm not doing any further work on it - if anyone wishes to take this over then please just ask.

Translation Method

Originally the intention was to translate purely by converting the MoinMoin markup to markdown markup - using the MoinMoin data retrieved from the filesystem.

However, although it makes determining the overall page list and revision list much easier, it was found that translating the wiki markup at this level was too complex and fragile for this to work without a huge amount of special casing.

So, after the revision structure is derived from the filesystem, each page revision is retrieved by http requests to the running MoinMoin wiki. This is then reduced to just the page content (by picking out the content div from the html), and some light editing applied to simplify the HTML - specifically:-

  • Remove the anchor spans that MoinMoin adds - these add no visual or readable content, but confuse the translator
  • Remove paragraph entries with CSS classes that start line - these again appear to be for non-required purposes (likely for showing diffs between revisions) - and they break the translator
  • Fix links that point within the wiki - if the target does not exist then the text is left but the link removed.
  • Strips CSS classes off links - again these upset the translator
  • Translate any images that appear to be MoinMoin emoji characters (which are rendered as images) into gollum emoji characters

This simplified HTML is then passed through the pandoc command:-

pandoc -f html -t gfm

And the resulting Github flavoured Markdown is taken as the new form.

This handles the vast majority of normal markup correctly, including lists and many types of tables. Some complicated markup or complex tables end up being passed through as HTML - which displays correctly but is less easy to parse and edit.

Attachments that are available in the wiki are also handled - they are put into a _attachments directory under a subdirectory named for the original page directory name. Links to attachments should be handled correctly.

Issues

The overall process is not particularly fast. But this should be something you only do once (or a few attempts) so raw speed is not needed.

Attachments are not versioned by MoinMon. This means any attachment that was deleted from MoinMoin is no longer available to put into the converted wiki. Any attachment that was updated a few times is only available in the last version (but will probably be inserted into the history at the point where it first appeared but with the latest content).

Installation

I have now made this available as a pypi package, in which case it can be installed by running

pip install moin2gitwiki

However to use it you will also need to install the pandoc and git packages as these commands are run during the conversion.

However it can be installed from the repo - it uses poetry to manage dependancies etc, so the best way to make use of this is to install poetry for your python version and then:-

poetry install

the command can then be run as

poetry run moin2gitwiki ...

Todo

  • Make tests effective

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

moin2gitwiki-0.8.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

moin2gitwiki-0.8.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file moin2gitwiki-0.8.0.tar.gz.

File metadata

  • Download URL: moin2gitwiki-0.8.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Darwin/22.4.0

File hashes

Hashes for moin2gitwiki-0.8.0.tar.gz
Algorithm Hash digest
SHA256 5ce4487bb947bdd1a18c13275e84d61906e7737103c68df0a8373fe22241c2a0
MD5 f214b90c757fdd2d369b7f36c487541c
BLAKE2b-256 03d5ef34c3ffb2e195d37e0ecc08a03ab8c25cfd3d1cb1821c5756a509dcfb85

See more details on using hashes here.

File details

Details for the file moin2gitwiki-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: moin2gitwiki-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Darwin/22.4.0

File hashes

Hashes for moin2gitwiki-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 960ebaf6f7fed47f9a10dfa1ba7f12e8f013f4b8d4a8500105da6fd7bde75351
MD5 b0b79bcdd088a73c81c16b30592360ff
BLAKE2b-256 e53ea89c5702c3e2b2fb87602f818e9dde58edc6ce332d109a0d356fefe6a77f

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