I switched my formatingrules to

*bold*, 'italic', _underline_

This is quite an easy hack but some may find my page usefull.

switching bold:

the regex matching the ''' is in "parse/transforms.php" (as documentated)

goto the function parse_bold

you'll find something like

function parse_bold($text)

{

return preg_replace("/'''(()|[^'].*)'''/Ue", "pair_tokens('bold', q1('\\1'))",

$text, -1);

}

change it to something like:

function parse_bold($text)

{

#return preg_replace("/'''(()|[^'].*)'''/Ue", "pair_tokens('bold', q1('\\1'))",

# $text, -1);

return preg_replace("/\*([^ *].*)\*/Ue", "pair_tokens('bold', q1('\\1'))",

$text, -1);

}

the bold one indicates the enclosing character (in my case * - which has to be escaped outside of charclasses (like [a-Z]))

i removed the () because i do not understand its need and fear the possibility of wiki-parse errors - please modifiy this document if this causes any errors

the blank is inserted to avoid messing up with the * list

the hack for switching italic to ' is the similar

just alter the parse_italic and replace ''

my final function is:

function parse_italic($text)

{

return preg_replace("/'([^'].*)'/Ue", "pair_tokens('italic', q1('\\1'))",$text, -1);

}

now to the underline feature:

add this function:

function parse_underline($text)

{

return preg_replace("/_([^_].*)_/Ue", "pair_tokens('underline', q1('\\1'))",$text, -1);

}

now alter the "config.php"

add the element 'parse_underline' to the $ParseEngine array

to the $DiffEngine? array

and last but not least add the following to the $DisplayEngine?

'underline_start' => 'html_underline_start',

'underline_end' => 'html_underline_end',

afterwards goto "parse/html.php"

and this somewhere

function html_underline_start()

{ return '<u>'; }

function html_underline_end()

{ return '</u>'; }

that should be all - please feel free to correct spelling/typing/thinking errors

regards,

Andreas Klinger


I believe changing away the original formatting is unfortunate, but me to wanted some alternate formatting. Therefore I proposed TaviPatches/TextEnhance which goes along the same lines --EvenHolen