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

Marc Cooper gmane at auxbuss.com
Thu Jun 8 05:58:16 CDT 2006


Patrick R. Michaud said...
> 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).

Thanks for confirming this.

Being new to PmWiki, it's not always immediately clear to me whether I'm 
not behaving myself :-|

> 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.

Yes, I'd spotted this.

> 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.)

In the case that caused me the problem, the following "paragraph" was a 
table (within a float/div). I'm not presuming that you haven't thought 
of such cases, but just in case.

> 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.

Yes, but where I am using floats (i.e. divs) containing tables and use a 
%define at the start of the page for the initial div, it's not so easy - 
I'm new here, so maybe it is. My current workaround is to move the %
define to the groupheader, but that's no use for editors that don't have 
access to groupheader, of course.

Perhaps I'm stretching things a bit by using floats as a formatting 
mechanism for the #wikitext part of the page rather than simply for 
floating a box or an image. However, it works - mostly - and is a 
fantastically powerful feature. Being able to dynamically format groups 
and pages - and allow the editors the same control on their pages - 
without having to edit a CSS is, I think, groundbreaking.

-- 
Best,
Marc





More information about the pmwiki-users mailing list