Skip to content

schnatterer/drupal2gollum

Repository files navigation

drupal2gollum

A basicly working drupal (html) to gollum (markdown) migration. 100% groovy.

Usage

  • Make sure to have Java Platform installed on your machine
  • Download drupal2gollum from here and extract.
  • Exemplary call:
    bin/drupal2gollum jdbc:mariadb://localhost:3306/databse?user=root&password=pw targetFolder drupalFilesFolder "Git author" "git-em@i.l"
    

More Details

I built this to be just enough to fulfil my needs of converting a 10-year old Drupal CMS (with ~400 pages and some plugins) to a gollum wiki. The program was rather hacked on a couple of afternoons try-and-error-style just to get my data ASAP to the new system with as less errors as possible. Not my best work.

Having said that, drupal2gollum still offers a couple of features. So it might be a starting point for others.

☑ Converts all drupal node revisions to Git revisions (HTML files)
☑ Converts all drupal files to gollum uploads
☑ Converts lastest node revision HTML to Markdown
☑ Converts HTML links to drupal files into links to gollum files (also for images)
☑ Converts taxonomy (latest revision only) to Tag heading at the end of each markdown page. The individual tags are converted to a list starting in tag= so you can use the gollum search to find tags using tag=... as search term.
☑ Converts Link node plugin syntax to gollum links
☑ Converts Footnode plugin syntax to links
☑ Converts Table of Concent plugin to gollum TOC tag
☑ Converts Syntax highliger plugin syntax to Fenced Code Blocks. Example: {syntaxhighlighter brush: java} or <pre class="brush: java; ...> to ```java ...
☑ Converts courier new fonts to back-ticks
☑ Keeps images as HTML Tags (in order to preserve height and `width`)
☑ Keeps tables as HTML Tags (in order to support nested and more complex tables)
☑ Corrects invalid nested lists: Example: <ul><ul> to <ul><li><ul>

Tested with Drupal 7.56 and MariaDB 10.2.8.

Limitations

  • Does not convert comments
  • Converts only the last revision of external files
  • Even though they are somewhat formatted, some file names still might not be compatible with gollum. This might result in an UTF8 error when uploading new files to gollum. In this case, rename any suspicious (non-ascii) file names.