[Forum] Spoiler Layout Breakage

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

[Forum] Spoiler Layout Breakage

Post by NeuralStunner »

Crossing spoiler and quote tags causes the layout to implode.
Spoiler: Screenshot

Code: Select all

[quote][spoiler]Stuff[/quote][/spoiler]
I don't know if this is fixable through tinkering with the spoiler bbcode or not.

(Hooray for PHP, HML, CSS and JavaScript all stuck together with tape and gum. :P )
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: [Forum] Spoiler Layout Breakage

Post by Nevander »

Isn't this because tags are supposed to be closed in the right order? Things can mess up like this in other languages too like HTML.

So this:

Code: Select all

[quote][spoiler]Stuff[/quote][/spoiler]
Should be this:

Code: Select all

[quote][spoiler]Stuff[/spoiler][/quote]
Or:

Code: Select all

[spoiler][quote]Stuff[/quote][/spoiler]
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by NeuralStunner »

Yes, that's what I mean by "crossing tags".
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: [Forum] Spoiler Layout Breakage

Post by Gez »

Best case, the parser can be made strict enough that

Code: Select all

[quote][spoiler]Stuff[/quote][/spoiler]
would be rendered as:
Spoiler:
[∕spoiler]

(Since the forum doesn't let us use html entities, I had to cheat a bit with the closing spoiler tag slash.)
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

I thought phpBB had handling in place to prevent that - as far as I remember it used to produce Gez's output more than it ever produced what NeuralStunner linked.

Nevertheless, I think that's more of a phpBB bug than it is a ZDoom Forums bug. DRD Team acts a little weird when you cross the tags, too.
User avatar
Dark-Assassin
Posts: 743
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: [Forum] Spoiler Layout Breakage

Post by Dark-Assassin »

It acts the same as crossing different HTML tags. It's not something that's going to be easily fixed. The best you can do is just fix your user (or their if you're a moderator) errors.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by NeuralStunner »

Eruanna wrote:I thought phpBB had handling in place to prevent that - as far as I remember it used to produce Gez's output more than it ever produced what NeuralStunner linked.
It does with other tags:

Code: Select all

[/quote]
It seems to be Quote+Spoiler that doesn't quite work right.

I'm not sure what spoiler code is in use here, but I don't have this problem on my own forum. Crossing these tags as in the OP will actually produce a functional spoiler inside a quote, since both are set up to use <BLOCKQUOTE>.
Spoiler: Codes I'm using
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

You used a [ code ] block which by definition ignores BB Codes inside of it. Some crossing of other internal codes is not handled quite as gracefully:

Code: Select all

[list][quote][*]test[/list][/quote]test
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by NeuralStunner »

Eruanna wrote:You used a [ code ] block which by definition ignores BB Codes inside of it.
Well, this mess also fails gracefully (if you can call it that):

Code: Select all

[spoiler][list][quote][wiki][/quote][/spoiler][/wiki][/list]
Spoiler:
[/wiki][/list]

The spoiler code in use must be doing something very, um, "special" with divs.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

It's clearly a phpBB bug, then. The <div> spoiler might be a little messy, sure, but there's no reason it should be failing that epicly, either. In fact, I believe safeguards should have long been in place to prevent that.

What's happening is since the HTML-bugger-up is happening with crossing tags, the </div> from the spoiler is messing with the forum's own <div> code (which it uses by default to show every post) - so, as you'll see, the forum layout will be just fine if you switch to the subsilver2 style, since it uses tables instead of <div>s.

Honestly, with HTML5 you could just define custom tags such as <forumspoiler> and attach a style to them and be just fine. As long as <forumspoiler> is set to "display: block" in CSS, it can be used in place of <div> and it should work. There's some more info about that here.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

I have gone and reported the issue. I don't know what version Randi uses so I didn't put that on the tracker, but I put my phpBB version there because the bug is still present.
Dark-Assassin wrote:It acts the same as crossing different HTML tags. It's not something that's going to be easily fixed. The best you can do is just fix your user (or their if you're a moderator) errors.
By the way, I just wanted to comment on this -

There is an actual "easy fix" for this. Simply count tags.

For each tag X, where [x] opens and [/x] closes, count every tag in between. Every open tag [y] increments the counter for [x] by 1, and every close tag [/y] decrements the counter.

If when [/x] closes from the tag count is not properly "0" - then reject the post, and give the user an error.

For nesting tags, this should simply be tracked from within each successful nesting.
User avatar
Dark-Assassin
Posts: 743
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: [Forum] Spoiler Layout Breakage

Post by Dark-Assassin »

Well, I admit that's something I never even would have considered.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

Don't worry, the more you manipulate software and code the more likely you are to create solutions like that. :) I am sure when the phpBB devs read this topic (since it's linked in the report) they'll probably come up with a better solution, anyway, since they've been working with that stuff far longer than I ever could hope to.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: [Forum] Spoiler Layout Breakage

Post by Nevander »

Eruanna wrote:There is an actual "easy fix" for this. Simply count tags.

For each tag X, where [x] opens and [/x] closes, count every tag in between. Every open tag [y] increments the counter for [x] by 1, and every close tag [/y] decrements the counter.

If when [/x] closes from the tag count is not properly "0" - then reject the post, and give the user an error.

For nesting tags, this should simply be tracked from within each successful nesting.
Wouldn't the original code not throw an error still since there's two opening and two closing tags?

Based on this fix...
it would count spoiler and /quote as 2
first tag increments x to 1
second decrements x to 0
ends in 0 - no error

Code: Select all

[quote][spoiler]Stuff[/quote][/spoiler]
The tags themselves need to be error checked for proper pairing. Unless I'm just misunderstanding this fix.
User avatar
Rachael
Posts: 13950
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Forum] Spoiler Layout Breakage

Post by Rachael »

Look more closely. It would only count the additional tags inside one tag "set", not the whole post. It already checks the whole post - if I just throw a random
Spoiler:
Post Reply

Return to “Closed Bugs [GZDoom]”