[Home]WikiBugs/StyleSheetCausesTextToDisappear

UseModWiki | WikiBugs | RecentChanges | Preferences

Bug: applies to V1.0

Switching on the sample wiki.css style sheet can cause text to disappear.

If a horizontal rule is preceded by a blank line e.g.

 Here is some text

 ----
 more text

Then you get the expected result of

Here is some text


more text

If you now add a style sheet to the wiki config then the Here is some text will disappear

Looking at the html source the only difference is the inclusion of the .css link <LINK REL="stylesheet" HREF="/bhwikidb/bhwiki.css">

The problem seems to be that the generated html source

 <hr class=wikilineheader></div><div class=wikitext>here is some text
 <p>
 <hr class=wikiline>more text

becomes invalid when used with the style sheet.

Possible Fix

The proposed solution is to avoid using <p> for blank lines and use <br>&nbsp instead

in

sub WikiLinesToHtml {

replace

    if (!$ParseParas){
      s/^\s*$/<p>\n/;                      # Blank lines become <p> tags	

with

    if (!$ParseParas){
 ##     s/^\s*$/<p>\n/;                    # Blank lines become <p> tags      # BH011
      s/^\s*$/<br>&nbsp\n/;                # Blank lines become <br>&bnsp tags# BH011 

This seems to work. Although it is only required when using a style sheet, it also seems to work correctly when you do not use style sheets in the config.

Update

This fix has two problems -
  1. it doesn't cure a <toc> followed by a horizontal rule (here the TOC itself partially disappears)
  2. it puts a leading space on the front of a new paragraph (could be a feature!)
The revised cure...
change the blanklines to <br> tags
 ##     s/^\s*$/<p>\n/;                    # Blank lines become <p> tags      # BH011
        s/^\s*$/<br>\n/;                   # Blank lines become <br> tags     # BH011 
and add a &nbsp before all the <hr class=wikiline> and <hr noshade class=wikiline>substitutions.
This is set in multiple lines to cater for the various ThinLine options.
The effect of this is that a single blank line no longer gives a new paragraph, it just starts a new line (just like manually adding a <br>!)
Two blanks lines are needed to start a new paragraph.
I personally like this so until a better fix comes along ....
--BrianHunter


I am using style sheets and I cant seem to make this go wrong --MarkButler

I can't reproduce this either. Do someone has a stylesheet which may cause problems? -- MarkusLude


UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 26, 2007 7:07 pm by MarkusLude (diff)
Search: