UseModWiki | WikiBugs | RecentChanges | Preferences

Fixed in 1.0.2 --MarkusLude

View this VariableParseParasYieldsOddOutputTestPage, it's the test page to reproduce the bug.

Setting $ParseParas=0 within the config file is ok while $ParseParas=1 yields the following html code:

<hr class=wikilineheader></div><div class=wikitext>*xx
</div><hr class=wikilinefooter>
The resulting html code needs more transformation.

Workaround: Add an extry empty line to VariableParseParasYieldsOddOutputTestPage or set $ParseParas=0.


I think I figured this out: in WikiToHTML these two lines are supposed to parse the paragraphs:

 $pageText =~ s/((.|\n)+?\n)\s*\n/&ParseParagraph?($1)/geo;
 $pageText =~ s/(.*)<\/p>(.+)$/$1.&ParseParagraph?($2)/seo;

But if the page consists of one block of text without two consecutive newlines, the first pattern never matches. The second pattern picks up stragling text that isn't followed by newlines, but it only works if there are more than one paragraph. So I changed the code to the following:

 $pageText =~ s/((.|\n)+?\n)\s*\n/&ParseParagraph?($1)/geo or
     $pageText =~ s/((.|\n)+?\n)\s*$/&ParseParagraph?($1)/geo;
 $pageText =~ s/(.*)<\/p>(.+)$/$1.&ParseParagraph?($2)/seo;

Of course that still won't work if the page consists of text with no trailing newline, but I've never seen that happen.

Could someone more familiar with the code confirm my fix?

-- Trent

I merged the two patterns and added it in 1.0.2:

 $pageText =~ s/((.|\n)+?\n)\s*(\n|$)/&ParseParagraph?($1)/geo;

Thanks for the report and the fix.

-- MarkusLude

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 30, 2007 6:50 pm by MarkusLude (diff)