1. Ikiwiki to Hugo conversion notes
  2. Why
  3. First conversion attempt
  4. Hugo ultra short primer
  5. Results
  6. Inventory
    1. Magic links
  7. Tasks
  8. Other converters

Why

First conversion attempt

I had to rename all files, and move stuff into content/, then things started generally working "working" (as in "breaking").

I had to clone a theme, the quickstart suggest:

git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke

Then I had a failure to parse comments:

Error: Error building site: "/home/anarcat/wikis/anarc.at/content/blog/2013-02-04-why-i-dont-pulseaudio.md:2:1": starting HTML comment with no end

Workaround, delete all comments:

505  2019-07-18 17:22:08 grep -l -r -- '<!--' * | grep -e comment  -e '\.md$'  | xargs  sed -i '/<!--/d'

Long term solution might be to convert to shortcodes.

I also tried:

607  2019-07-18 17:11:55 grep -l -r -- '-->$' * | grep -e comment  -e '\.md$'
608  2019-07-18 17:12:15 grep -l -r -- '-->$' * | grep -e comment  -e '\.md$' -0 | xargs -0 sed -i 's/-->$/!-->/'
609  2019-07-18 17:12:23 grep -l -r -- '-->$' * | grep -e comment  -e '\.md$'  | xargs  sed -i 's/-->$/!-->/'

Another failure is when it finds an HTML file with an unquoted href argument (e.g. hardware/phone/htc-one-s/apps.html).

Hugo ultra short primer

Maybe the Emacs mode could be useful.

Results

Result of running hugo build after the renames:

                   | EN   
+------------------+-----+
  Pages            | 734  
  Paginator pages  |  63  
  Non-page files   | 549  
  Static files     |   3  
  Processed images |   0  
  Aliases          |  12  
  Sitemaps         |   1  
  Cleaned          |   0  

Things generally look like crap:

Inventory

List of directives used in my wiki:

$ git grep -h '\[\[!' | sed 's/\[\[!/\n[[!/g' | grep '\[\[!' | sed 's/ .*//' | sort | uniq -c | sort -n
      1 [[!bibtex2html <span class="error">Error: cannot find bestlink for &quot;^&quot;</span>]]
^ false positive, in software/ikiwiki-osm
      1 <a class="toggle" href="#services-wiki-ikiwiki-hugo-conversion.default">more</a>
^ IMPORTANT, need to figure it out
     18 [[!img
^ IMPORTANT, need to figure it out
     22 [[!color
^ services table, rebuild by hand
     26 [[!iki
^ shortcodes?
     50 [[!format
^ IMPORTANT, need to figure it out
     55 [[!shortcut
^ shortcode, false positive (in shortcuts)
     72 [[!wikipedia
^ shortcode
     96 [[!toc
^ IMPORTANT, need to figure it out (see aboev)
    109 [[!debcve
^ shortcode
    115 [[!debbug
^ shortcode
    142 [[!debpkg
^ shortcode
    268 [[!inline
mostly used in frontpage and blog, need to figure out
    335 [[!tag
^ IMPORTANT, need to figure it out
    358 [[!comment
^ IMPORTANT, need to figure it out
   1254 [[!meta
^ IMPORTANT, need to figure it out

There are also a ton of "magic ikiwiki links", called wikilink, which have their own unique logic:

$ git grep -h '\[\[' | sed 's/\[\[/\n[[/g' | grep '\[\[' | wc -l 
631

Those will be difficult to convert as the semantics of internal linking in Markdown is not well defined. Or rather, it's bound to HTML (in general) and ikiwiki goes beyond that. Some research needs to be done to see how other engines handle this and how it compares to the linkingrules.

The peculiarities of wikilinks in ikiwiki:

Tasks

the gist of it is we need to implement:

structural elements needing more thinking:

will be converted by hand:

Work is ongoing in this conversion script.

Other converters

Created . Edited .