[pmwiki-users] Knowing line no. being processed

V.Krishn vkrishn at insteps.net
Tue May 11 15:59:27 CDT 2010

On Wednesday 12 May 2010 1:53:54 am you wrote:
> On Tue, May 11, 2010 at 4:33 PM, V.Krishn <vkrishn at insteps.net> wrote:
> > Is there a variable that keeps track of line number of the wiki page
> > being processed?
> >
> Pmwiki is more "rule-based" than "line-number-based".  At certain stages
> I believe the rule-processor does process a line at a time, but it's more

Thats ok how pmwiki process the page text. Just that I thought, (if I am not 
mistaken) since  pmwiki process the wiki text line-wise searching for rules, 
it might be keeping track of the line number its processing.

> helpful to think of pmwiki as being a series of "smart search-and-replace"
> operations that operate over the whole text -- line-by-line may occur, but
> usually identifying the rule is much more important than identifying the
> line.
> If finding the rule would be helpful you can look in
> http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors and search
> for "markuptohtml" --  you will find a way that can be helpful in
> identifying which rule caused a certain change.  Do note the comments about
> the size of the logfile and the slow-down it causes -- this is a temporary
> debugging step rather than something that can be left in a live site...
> If you already know the rule you are working with and need to know the line

This is true for problem I am working on.
Though there might me another solution to it.
Here is the problem:
I have a Markup A B C which can by using MarkupToHTML() go into a cyclic call 
to each other,
Like LOOP 1: A --calls--> B --calls--> C --calls--> A
Like LOOP 2: A --calls--> B --calls--> C --calls--> A
I can terminate loop 1 when it reaches the last call by using some static or 
global variable,
but then that same variable becomes applicable for the second loop too and 
thus terminating it prematurely.

My earlier thought was to identify individual loop distinct by recognising its 
line number, that way each loops ends on maturity.

Hope I am clear with the problem.

> number of the page text there may be something you can trace out in
> MarkupToHTML(), but in looking through that function just now I can't find
> anything line-based unless I'm just missing it...  ($text is typically a
> string, not an array, as I read it, particularly when called from
> HandleBrowse()...)
> -Peter


More information about the pmwiki-users mailing list