A reliable script to convert Tiki-Wiki tables to MediaWiki format?

301 Views Asked by At

I know I can copy the rendered Tiki-Wiki page into LibreOffice and then export it into MediaWiki format, but what about hundreds of pages? Is there a reliable script?

I need to convert only tables.

1

There are 1 best solutions below

0
On

You need to convert this:

||row1-column1|row1-column2||row2-column1|row2-column2||

Into this:

{|
| row1-column1||row1-column2
|-
| row2-column1||row2-column2
|}

So your script has to do 5 string substitutions:

  1. Replace the first || by {|\n
  2. Replace the last || by \n|}
  3. Replace every other || by @@SEPARATOR_ROW@@
  4. Replace every | by ||
  5. Replace every @@SEPARATOR_ROW@@ by \n|-\n

Another way could be to convert your tiki table in HTML format, as MediaWiki also supports HTML format.

References for the wiki syntax: