Table elements that contain only white space look weird in most browsers.
x | x | x | |
x | |||
x | x | x |
A common workaround ist using & nbsp;
instead.
Here is the patch (you must copy from the edit page!):
+ sub table_nbsp { + my $elem = $_[0]; + $elem =~ s/(?<=\|\|)(\s+)(?=\|\|)/ /g; + $elem =~ s/^(\s+)(?=\|\|)/ /; + $elem =~ s/(?<=\|\|)(\s+)$/ /; + return $elem; + } sub WikiLinesToHtml { my ($pageText) = @_; my ($pageHtml, @htmlStack, $code, $codeAttributes, $depth, $oldCode); @htmlStack = (); $depth = 0; $pageHtml = ""; foreach (split(/\n/, $pageText)) { # Process lines one-at-a-time $code = ''; $codeAttributes = ''; $TableMode = 0; $_ .= "\n"; if (s/^(\;+)([^:]+\:?)\:/<dt>$2<dd>/) { $code = "DL"; $depth = length $1; } elsif (s/^(\:+)/<dt><dd>/) { $code = "DL"; $depth = length $1; } elsif (s/^(\*+)/<li>/) { $code = "UL"; $depth = length $1; } elsif (s/^(\#+)/<li>/) { $code = "OL"; $depth = length $1; } elsif ($TableSyntax && s/^((\|\|)+)(.*)\|\|\s*$/"<TR VALIGN='CENTER' " . "ALIGN='CENTER'><TD colspan='" - . (length($1)\/2) . "'>$3<\/TD><\/TR>\n"/e) { + . (length($1)\/2) . "'>" . table_nbsp($3) . "<\/TD><\/TR>\n"/e) { $code = 'TABLE'; $codeAttributes = "BORDER='1'"; $TableMode = 1; $depth = 1; } elsif (/^[ \t].*\S/) { $code = "PRE"; $depth = 1; } else { $depth = 0; }--StefanTrcek