# Wiki 2 HTML definitions
# Search;Replace
###############################################################################
#=====================================================[ pre-formatted text ]===
/^(?<!!)\{\{\{$(.*?)^\}\}\}$/ms;<pre>$1</pre>
/^!\{\{\{/m;{{{
/(?<!!)\{\{\{(.*?)\}\}\}/m;<code>$1</code>
#the following does not work, since it would be interpreted as variable:
#/!\{\{\{(.*)\}\}\}/;{{{$1 }}}
/!\{\{\{/;{{{

#=================================================[ simple text formatting ]===
/(?<!!)'''''(.*?)'''''/m;<b><i>$1</i></b>
/(?<!!)(?<!')'''(.*?)'''/m;<b>$1</b>
/(?<!!)(?<!')''(.*?)''/m;<i>$1</i>
/!'''''/;'''''
/!'''/;'''
/!''/;''
/(?<!!)__(.*?)__/m;<u>$1</u>
/!__/;__
/(?<!!)~~(.*?)~~/m;<del>$1</del>
/!~~/;~~
/(?<!!)\^(.*?)\^/m;<sup>$1</sup>
/!\^/;^
/(?<!!)\,\,(.*?)\,\,/m;<sub>$1</sub>
/!\,\,/;,,

#===============================================================[ headings ]===
/^(?<!!)\={6}(.*?)\={6}\s*$/m;<h6 class='wikihead'>$1</h6>
/^(?<!!)\={5}(.*?)\={5}\s*$/m;<h5 class='wikihead'>$1</h5>
/^(?<!!)\={4}(.*?)\={4}\s*$/m;<h4 class='wikihead'>$1</h4>
/^(?<!!)\={3}(.*?)\={3}\s*$/m;<h3 class='wikihead'>$1</h3>
/^(?<!!)\={2}(.*?)\={2}\s*$/m;<h2 class='wikihead'>$1</h2>
/^(?<!!)\={1}(.*?)\={1}\s*$/m;<h1 class='wikihead'>$1</h1>
/^!([\=]{1,6})/m;$1

#==================================================================[ lists ]===
#--------------------------------------------------[ simple unordered list ]---
/^$(\n) \* (.*)\n/m;<ul>$1 <li>$2</li>$1
/^ \* (.*)$(\n)^$/m; <li>$1</li>$2</ul>
/^ \* (.*)$/m; <li>$1</li>

#---------------------------------------------------[ simple ordered lists ]---
/^$(\n) a\. (.*)\n/m;<ol style='list-style-type:lower-alpha'>$1 <li>$2</li>$1
/^$(\n) A\. (.*)\n/m;<ol style='list-style-type:upper-alpha'>$1 <li>$2</li>$1
/^$(\n) i\. (.*)\n/m;<ol style='list-style-type:lower-roman'>$1 <li>$2</li>$1
/^$(\n) I\. (.*)\n/m;<ol style='list-style-type:upper-roman'>$1 <li>$2</li>$1
/^$(\n) 1\. (.*)\n/m;<ol style='list-style-type:decimal'>$1 <li>$2</li>$1
/^ [aAiI1]\. (.*)$(\n)(?! [aAiI1\*])/m; <li>$1</li>$2</ol>
/^ [aAiI1]\. (.*)$/m; <li>$1</li>

# Still missing are nested (multi-level) lists
# count of leading spaces: level (second level only if there is first level, etc.)

# definition lists???
# discussion citations?

#=============================================================[ paragraphs ]===
/^$(\n)(([ ]{2}(?<!(a\.|A\.|i\.|I\.|\* )).+\n)+?)(?![^\S\n])/m;<blockquote>$2</blockquote>
/(?<!!)\[\[br\]\]/i;<br>
/^\-\-\-\-(\-)*$/m;<hr>
/^!(\-\-\-\-(\-)*)$/m;$1
/^$/m;<br><br>

#=================================================================[ tables ]===
#-----------------------------------------------[ simple style (trac-like) ]---
/([^!\|]\n)^\|\|/m;$1<table border='1' class='wikitable'><tr><td>
/\|\|(\n[^!\|])/m;</td></tr></table>$1
/^\|\|/m;<tr><td>
/\|\|(\n)/;</td></tr>$1
/\|\|/;</td><td>
#----------------------------------------------[ additional: table headers ]---
/([^!\|]\n)^!!/m;$1<table border='1' class='wikitable'><tr><th class='wikith'>
/!!($^[^!\|])/m;</th></tr></table>$1
/^!!/m;<tr><th class='wikith'>
/!!(\n)/;</th></tr>$1
/!!/;</th><th class='wikith'>

#=================================================================[ images ]===
/(?<!!)\[\[image\((.*?)\)\]\]/i;<img src='$1' alt=''>
/(?<!!)\[\[image\:(.*?)\]\]/i;<img src='$1' alt=''>

#==================================================================[ links ]===
/(?<!!)\[\[(?<!br)(?<!image)(\S*)\s+(.*?)\]\]/;<a href="$1">$2</a>
/(?<!!)\[\[(?<!br)(?<!image)(\S*)\]\]/;<a href="$1">$1</a>

/!\[\[/;[[
