#!/usr/bin/sed -f
#attention: this is the solaris version
#this is a script to convert tiki wiki to moinmoin wiki page source
#convert headlines
s/^-\([=]*\)\([^=]*\)\1-$/\1 \2 \1/
#convert boldface
s/\_\_\([^_]*\)\_\_/'''\1'''/g
#convert enumeration
s/^#/ 1. /
#convert list
s/^\*/ \*/
#link conversion: replace "|" by " " in links
/\[/,/\]/ s/\(\[[^|]*\)\|\([^]]*\]\)/\1 \2/g
/\{/,/\}/ {
#convert local picture files to attachments
s/\{picture file=img\/wiki_up\/\/\([^}]*\)\}/attachment:\1 /g
#convert picture links
s/\{img src=\([^}]*\)\}/ \1 /g
}
#remove {SPLIT()} commands
/\{SPLIT()\}/,/\{SPLIT\}/ {
s/^ -//
s/\{SPLIT()\}/----/
s/\{SPLIT\}/----/
}
#convert ))TikiPage(( to !TikiPage
s/))\([^(]*\)((/\!\1/g
#table conversion
/\|\|/,/\|\|/ {
#remove || at beginning and end of table
s/\|\|//g
#put | at beginning and end of a table row
s/^\([^|]*\)\|/\|\1\|/
s/\|\([^|]*\)$/\|\1\|/
#replace | by ||
s/\|/\|\|/g
}
#convert centered things
s/^::\(.*\)::$/\|\|\<tablestyle="width:100%; text-align:center;"\> \1 \|\|/