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.5.0

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.5.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moin2gitwiki-0.5.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moin2gitwiki-0.5.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/4.15.0-1077-gcp

File hashes

Hashes for moin2gitwiki-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0736e889cfcb6cc1d475ca663dce85c9431e77d3083ece0bcf8d3b23539f6544
MD5 f570644727c782f17dd59d5bdeecafac
BLAKE2b-256 24e6170f2b4dffd1ac943f888f3216f46981f780c5b340de51b7c876085e2796

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moin2gitwiki-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/4.15.0-1077-gcp

File hashes

Hashes for moin2gitwiki-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 696744af21dbff52f0ae0f61a199c2c53d36910f293415d8c8575acea140c589
MD5 4944265aa8734262e921ca854b5cb212
BLAKE2b-256 eb945c7dfbb4ce6edef7684396e588d800c1581678855b2a42da404ee565b6ff

See more details on using hashes here.

Supported by

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