Fixed BBCode nested INDENT tags don't behave as expected

Dominion

Active member
I've just run across an oddity in the way nested BBCode INDENT tags are parsed.

I tried posting the following variation on the example from the BBCode help page:

Code:
Regular text
[INDENT]Indented text
[INDENT]More indented[/INDENT]
Less indented[/INDENT]

You would expect this to render with the fourth line indented to the same depth as the second, and that is exactly what happens. If you try editing the post as plain text, however, you get this:

Code:
Testing a more complex version:
Regular text
[INDENT=1]Indented text[/INDENT]
[INDENT=2]More indented[/INDENT]
Less indented

So the last line gets displayed as INDENT=1, even though the editor thinks it isn't indented at all. :confused:

I presume posting the version displayed by the plain text editor will cause the fourth line to become unindented, necessitating further editing of the post to get it right.

If we really want people using nested INDENT tags, then perhaps the BBCode parser should be fixed so it correctly decrements the depth parameter and uses that value to indent text appearing between nested /INDENT tags. I don't know if this is possible, though.

An easier solution would be to avoid promoting the use of nested INDENT tags, as I suggest here.
 
That's just due to the fact that you're switching from WYSIWYG to plain text, so the WYSIWYG editor still gets a chance to mangle the bbcode/markup (which is just TinyMCE being TinyMCE). If you use the user preferences setting 'Use the rich text editor to create and edit messages' then the bbcode comes out as in your first example.

Just made a relevant suggestion: http://xenforo.com/community/thread...-switching-wysiwyg-plain-with-no-edits.16136/ :)
 
I expected it would be something like that. It's much like the issue I mentioned a while ago in regard to BBCode lists. Both are issues I've noticed happening with BBCode in various forums over the years.

It'd be great if XF worked out these kinks so folks could switch between WYSIWYG and plain text and always get what they're expecting to see. (Yes, I know that's a tall order. ;) )
 
We've established that HTML -> BB code conversions are hard. However, this shows the other challenge: BB code conversion to the specific flavor of HTML that we need to for the WYSIWYG editors. It too is evil. :)
 
Top Bottom