Looks like civilization finally caught up with us.

Mal ,'Bushwhacked'


Buffistas Building a Better Board  

Do you have problems, concerns or recommendations about the technical side of the Phoenix? Air them here. Compliments also welcome.

To-do list


John H - Nov 19, 2002 4:56:19 pm PST #1644 of 10000

Oh this is just spiralling out of control, or at least it's gone too far for my brain to figure it out.

I just noticed that

<b>test test test <i>test</i></i>

causes the total tag count to come out to zero, because of course the too-many-b-tags is cancelled out by the not-enough-i-tags and so it's giving the all clear.

Brain Hurt. Need Alcohol. But -- Payday Tomorrow! What Do?


John H - Nov 19, 2002 5:00:12 pm PST #1645 of 10000

I'm not entirely sure how A works, though, or what a<0 means practically

A goes like this: when we find an opening tag, put it onto the end of a list of opening tags. When we find a closing tag, if it matches the last item in the list of opening tags, we remove the last item of the list.

So if we encounter B, then, I, then FONT, and then later we encounter /FONT, then /I, then /B, we got as high as three and then went back to zero.

So it's logically impossible for A to be less than zero, because the only cases in which stuff gets removed are based on there still being at least one tag in A.

So we don't need "A less than zero" cases after all.


Rob - Nov 19, 2002 5:00:51 pm PST #1646 of 10000

I think you should drop the associative array. You don't need it.

Instead, each time you find an open tag, push it into the array. Each time you find a closing tag, search your array from the end going backwards until you find a matching open. Delete the matching open from the array.

At the end, walk the array backwards and emit one closing tag for each opening tag still in the array.


John H - Nov 19, 2002 5:02:32 pm PST #1647 of 10000

Back to:

A B Diagnosis 0 0 Everything is fine. 0 >0 Broken 0 <0   >0 0   >0 >0 Broken >0 <0  


John H - Nov 19, 2002 5:08:21 pm PST #1648 of 10000

you should drop the associative array. You don't need it.

Why did I think I needed it? Oh yeah, because the array might not work if the closing tags were present, just not in the right order. And your recipe fixes that.

What do people think? It's certainly a flawed implementation the way it is now, just giving an overall total, because like I said, 1000 missing open-bold tags and 1000 extra close-font tags comes out to zero, giving a false negative.


Hil R. - Nov 19, 2002 5:09:29 pm PST #1649 of 10000
Sometimes I think I might just move up to Vermont, open a bookstore or a vegan restaurant. Adam Schlesinger, z''l

First blank: extra closing tags. Probably OK.
Second blank: tags out of order, but all close. Probably OK.
Third blank: tags closed out of order, plus extra closing tags.


Jessica - Nov 19, 2002 5:12:13 pm PST #1650 of 10000
And then Ortus came and said "It's Ortin' time" and they all Orted off into the sunset

extra closing tags. Probably OK.

...unless one of them is t /table


John H - Nov 19, 2002 5:21:22 pm PST #1651 of 10000

Yeah this is just a check of formatting tags at the moment. The problem with table tags is you can't just count them, you have to validate a structure: TABLEs containing x number of TRs containing x number of TDs...

I think I might have to go back to that link with the full PHP parser...


Rob - Nov 19, 2002 5:25:43 pm PST #1652 of 10000

I bet that if you put in a close table tag for each open table tag, the board wouldn't be broken and all would be good. The message itself might look like crap, but we're not trying to solve that problem.

John, if you'll send me a copy of the test setup from your server, I'll take a whack at coding it up tonight.


John H - Nov 19, 2002 5:33:30 pm PST #1653 of 10000

I'm happy to try your solution on my site right now Rob, I'll play with it for a while and see what I come up with.

But now I'm looking for that post which mentioned some full HTML parsing module in PHP and I can't find it.