[Pmwiki-users] %comment% markup

Esa Holmberg ekho
Sat May 22 17:14:06 CDT 2004


On Saturday 12 July 2003 06:29, Patrick R. Michaud wrote:
> I've gone ahead and implemented %comment% as a WikiStyle markup
> using the CSS "display:none" tag, and expect to release it in
> pmwiki-0.5.7.
>
> However, I got email from someone who indicated that "display:none"
> doesn't work in Netscape 4; I tested it in Netscape 4.08 and it worked
> fine for me, but perhaps "display:none" doesn't work in other versions
> of Netscape (or possibly other browsers), and therefore I should use a
> different approach.  Could I get people to help me test this?

Hi,

A friend of mine noticed that the comments are shown at least with the elinks 
browser. Same appears to be the case with lynx.

As a relatively new user of pmwiki, I searched through the mailing list 
archive to see whether the comment topic would be already covered there, and 
found this chain. There was no clear solution introduced though, so I did 
some testing on the issue.

Apparently most browsers nowadays keep the non-displayable areas hidden, but 
there are browsers which do not care about the display styles.  It could also 
be considered unwise to transmit the contents of the comments at all - they 
could contain some on-site information which the admin could prefer to be 
kept hidden. For example, maintenance instructions, contact information etc.

I did a minimal change in the pmwiki.php file, modifying the end of the 
function ApplyStyles($x) :

if ($styleattr != "style='display:none; '") {
      if ($styleattr || $classattr)
        $out .= "<span  $classattr $styleattr>$l</span>";
      else $out .= $l;
}
    }
  }
  return $out;
}

This leaves out the comment contents, as long as the comments are defined with 
the "display:none" style.

This is by no means an elegant way to do this, but just a very quick&dirty 
workaround. Possibly a variable HideCommentsFromHTML or such could be used to 
select whether to hide or not, or a change to the default behavior. The 
latter could introduce a problem, as someone may have found some use to the 
contained comments.. you never know.

/Esa





More information about the pmwiki-users mailing list