Simon: You are my beautiful sister. River: I threw up on your bed. Simon: Yep. Definitely my sister.

'War Stories'


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 - Sep 23, 2002 6:01:18 pm PDT #354 of 10000

How about we pop them on a stack, and pop them back off again?

That makes sense. Though doing it by brute calculation would probably do just as well, what with the not-knowing-what-people-intended thing.

like:

if($number_of_a_tags > $number_of_close_a_tags){
print '</a>'}

kind of thing.


Typo Boy - Sep 23, 2002 6:08:39 pm PDT #355 of 10000
Calli: My people have a saying. A man who trusts can never be betrayed, only mistaken.Avon: Life expectancy among your people must be extremely short.

In netscape they stayed pink until the new page.

And yes, I think a brute count will work fine. (Needed on post only).

If there are is one fewer end pre than pre, you add an end pre to end of the post -ditto with bolds, italics table and so forth. Don't worry if it screws up the person's post. They can edit it if they wish. So long as it does not screw up the next persons post. So that really is a single additional pass once tag stripping is done.

We are not corecting all possible problems - just some simple ones where other peoples post can be hurt.


John H - Sep 23, 2002 6:12:35 pm PDT #356 of 10000

/me realises that it should be:

for($number_of_a_tags - $number_of_close_a_tags){
print '</a>'
}

above. But you get the idea.


Typo Boy - Sep 23, 2002 6:17:41 pm PDT #357 of 10000
Calli: My people have a saying. A man who trusts can never be betrayed, only mistaken.Avon: Life expectancy among your people must be extremely short.

Exactly.


§ ita § - Sep 23, 2002 8:26:05 pm PDT #358 of 10000
Well not canonically, no, but this is transformative fiction.

The brute count doesn't respect the order, and you will risk putting out invalid html if they let two tags slip.

A stack, OTOH, will address some of that.


John H - Sep 23, 2002 8:41:26 pm PDT #359 of 10000

you will risk putting out invalid html if they let two tags slip.

Well yeah, but we've already got invalid HTML or we wouldn't be doing it.

A stack, OTOH, will address some of that.

So how do you envisage it working?

I'm just not seeing it in my mind.

Every tag gets pushed onto the end of an array, and then popped off it by the appearance of a closing tag?

Like, we encounter a FONT tag, the array becomes

FONT

then we encounter a bold tag, and the array is now

FONT,B

but then we encounter the close-B tag and dump the B, and we're back to:

FONT

and then when we get to the end of the post, if there's anything left in the array, that's what needs closing?

What happens if someone accidentally posts this then:

<FONT> blah blah blah <B> blah blah </FONT> blah blah </B>

because they match, but not in the right order.


§ ita § - Sep 23, 2002 8:44:45 pm PDT #360 of 10000
Well not canonically, no, but this is transformative fiction.

I got some debugging to do, true, but if WX can output them in order, so can we. I'm just not going to have energy to logic it before tomorrow.


John H - Sep 23, 2002 8:55:16 pm PDT #361 of 10000

if WX can output them in order, so can we

That's the spirit!

What if we recorded the tags according to their position in the string?

blah blah blah <FONT>

would be stored in a hash with a key of 16 (because it starts at char 16) and a value of FONT.

Then all we need to do is see if there's a close-font with a greater number as its key.


§ ita § - Sep 23, 2002 8:58:10 pm PDT #362 of 10000
Well not canonically, no, but this is transformative fiction.

Or! Or! Or!

We pop on opening tags. We delete (push or whatever) them when we encounter a closing tag. Then we close what's left in reverse order.

But I have to look up array searching.


John H - Sep 23, 2002 11:12:32 pm PDT #363 of 10000

We pop on opening tags. We delete (push or whatever) them when we encounter a closing tag.

How does that work for crossed-over tags, that's my question, like before.