[pmwiki-users] processing order

Peter & Melodye Bowers pbowers at pobox.com
Mon Feb 18 15:38:36 CST 2008

> Peter & Melodye Bowers said...
> > I have a MarkupExpression I am putting together which reads a given
> page,
> > checks for a certain value, and if it doesn't find it then it writes the
> > value to the end of the page.
> >
> > I am finding inconsistent results with it where often it somehow writes
> the
> > value *before* the read, even though there's no possibility that I can
> see
> > that that could happen based on my code.  And the strangest thing is
> that I
> > have all this code heavily debugged both with MessageFmt[]/(:messages:)
> as
> > well as using straight echo statements.  The WikiShEcho() function
> clearly
> > is *NOT* processing according to both types of debugging statements and
> yet
> > the value is getting written to the page before the WikiShGrep tries to
> read
> > it.
> >
> > Is there any kind of situation in which directives (like markup
> expressions)
> > get processed twice in a single browse of a page?  Or (more surprising)
> that
> > echo statements could somehow be suppressed during an earlier invocation
> of
> > the MX?
> Have you followed the instructions from:
>   /PmWiki/CustomMarkup
> The problem might also stem from the format of the content you are
> returning to PmWiki - whether it is markup, a directive, HTML, etc. -
> where Keep($result) might be necessary.

I have looked through this before, Marc, and just re-read it, but nothing
rang any bells about what might be causing my problem...  I don't see much
on Keep() in there...  

I have confirmed that the markup expression I am working is indeed being
called twice.  I had to put debugging statements in including microtime()
output and run it on a slower computer to be able to catch (via a quick
printscreen) a flash of debugging (echo) output.  This flashes by (on the
slow computer -- too fast to catch on a faster computer) and is immediately
replaced by almost identical debugging output.  By carefully comparing the
microtime() timestamps on my printscreen version to the final version it is
clear that they are 2 separate invocations.  I then put debugging in
MarkupExpression() (in scripts/markupexpr.php) with the same sort of
microtime() debugging and confirmed that MarkupExpression() itself is being
called twice.

Any idea how this could happen?  How do echo statement outputs get cleared
from a screen?  How does MarkupExpression() get called multiple times when
there's only one call?  I'm sure it's something I'm doing, but I don't have
a clue where to look...

Is it possible that pmwiki might process through a page once and then "look"
at the output of that run-through again to see if there are any further
markups that need to be processed recursively?  I'm shooting in the dark
here, but that would make sense if that's what it does...  (I don't see any
markup in the results -- I'm coming up with a pretty blank page actually,
but at least it would give me something to point at...)


More information about the pmwiki-users mailing list