[pmwiki-users] Empty <p> when using %defiine%. Why?

Patrick R. Michaud pmichaud at pobox.com
Wed Jun 7 15:25:20 CDT 2006


On Wed, Jun 07, 2006 at 02:06:34PM -0500, Patrick R. Michaud wrote:
> On Wed, Jun 07, 2006 at 07:21:50PM +0100, marc wrote:
> > When a page starts with a %define% you get:
> > 
> > <!--PageText-->
> > <div id='wikitext'>
> > <p>
> > </p>
> > [...]
> > I guess there must be a reason for this <p> being there, but I can't 
> > find what that reason might be.
> 
> 
> It's a bug, although it's one I thought I already fixed.
> However, I can't find any evidence of fixing it in PITS 
> or in the ChangeLog, so I must not have fixed it yet.  :-(
> 
> I'm guessing I need a special markup rule to recognize
> lines containing nothing but wikistyles and not generate
> output for them (although they still need to be processed).

Actually, in checking this further it appears that currently
lines with only wikistyles wikistyles can still have side-effects... 
for example:

    %center blue%
    Here is a paragraph.
    It's centered and with blue text.

So, I'm thinking that the correct solution here would be to
specially handle lines that start with "%define=" and
contain only wikistyle definitions, since it's unlikely that
such markup lines are being used to affect a paragraph that
immediately follows.  (And in the rare case that it is being
used this way, it's pretty easy to adjust the wikistyle so that
it still works.)

Thus, we would have

    %define=foo green%

    This paragraph is normal, and the above wikistyle doesn't generate
    an empty <p>...</p>, although it does set the 'foo' wikistyle.

    %center blue%
    This paragraph is centered and blue.

    %define=bluepara center blue%
    This paragraph is normal, because the define= above is treated
    as definitional only.

    %bluepara%
    This paragraph is also centered and blue.

    %bluepara%  So is this one.


Comments?

Pm




More information about the pmwiki-users mailing list