This patch attempts (I'm new at this patching business) to repair the following conditions:
<P><HR><P>
and <P><H1>Head<h1><P><P>
This patch inserts a <P> tag at the top of the file if the first line is not otherwise marked up. It also inserts <P> tags in blank lines only if the blank line is not followed by a markup tag. It closes <P> tags with </P> appropriately.
At the end of sub WikiLinesToHtml, insert patch "jer" as follows just above the return:
#jer------------ $pageHtml =~ s/^([A-Za-z0-9])/<p>$1/; # Start with <p> if needed $pageHtml =~ s/\n\s*\n([A-Za-z0-9])/<\/p>\n<p>$1/g; # Close and open <p> on blank lines $pageHtml =~ s/(\n<p>.*?\n)(\s*\n<)/$1<\/p>\n</g; # Close on blank if next is < $pageHtml =~ s/(<\/pre>|<\/p>)\s*\n<\/p>/$1\n/ig; # Remove duped closing tags #jer end return $pageHtml;
A little above that, comment-out the blank line conversion as follows:
#s/^\s*$/<p>\n/; # Blank lines become <p> tags
I am currently testing this on a hidden wiki with giddily encouraging results. -- JerryMuelver
$BreakLines = 1; # 1 = every cr in text is a <br> in html , 0 = old compatible codeThen in WikiLinesToHtml I changed
s/^\s*$/<p>\n/; # Blank lines become <p> tagsto
if ($BreakLines) { s/^\s*$/<br>/; # Blank lines become <br> tags } else { s/^\s*$/<p>\n/; # Blank lines become <p> tags }
This makes my site look nice. I'm not sure if it fixes all of the problems you encountered above. -Chris Tulino
1166,1167c1166,1167 < $pageText =~ s/((.|\n)+?\n)\s*\n/&ParseParagraph($1)/geo; < $pageText =~ s/(.*)<\/p>(.+)$/$1.&ParseParagraph($2)/seo; --- > $pageText = &CommonMarkup($pageText, 1, 0); # Multi-line markup > $pageText = &WikiLinesToHtml($pageText); # Line-oriented markup 1171,1179c1171,1172 < } < < sub ParseParagraph { < my ($text) = @_; < $text = &CommonMarkup($text, 1, 0); # Multi-line markup < $text = &WikiLinesToHtml($text); # Line-oriented markup < return "<p>$text</p>\n"; < } < --- > } > 1294c1287 < #s/^\s*$/<p>\n/; # Blank lines become <p> tags --- > s/^\s*$/<p>\n/; # Blank lines become <p> tags
I am not testing this patch well, but it seems working for me so far. I am also currently working on make UseMod compatible XHTML, which seems a lot of works. --TakuyaMurata