Duplicate  BBcode lists not formatting as expected

Dominion

Active member
I'm not sure whether this a bug or what, but it struck me as odd so I thought I'd mention it.

In various forums I've occasionally wanted to format lists with space between each item, so they would be easy to read. I was generally able to accomplish this with code like the following:
Code:
[LIST=1]
[*]This is item number one.

[*]This is item number two.

[*]This is item number three.
[/LIST]
When I try doing this with XenForo, however, the blank line immediately preceding the item tag gets deleted, so that the results are the same as if I hadn't added the spaces:
  1. This is item number one.
  2. This is item number two.
  3. This is item number three.
It is possible to achieve the desired effect by entering twoblank lines rather than just one before each item tag. One of the blank lines gets deleted, leaving the other to separate the items as desired, like so:
  1. This is item number one.

  2. This is item number two.

  3. This is item number three.
This makes for a good workaround, until the author decides to go back and edit the post. Then, since there is now only one blank line before each item tag, editing and saving will remove the spacing. So each time the author edits the post, he must also go back and adjust the spacing of the list items to restore the deleted lines, which is inconvenient.

I dunno, perhaps I'm expecting BBcode to do something that it wasn't intended to do in the first place. But it seems odd that only one blank line before each item tag is deleted; this makes me thing it's a bug of some sort.

If possible, it would be nice if these lines didn't get deleted. That would give folks a bit more control over the formatting of their posts.
 
Ah, thanks for pointing those out. Since I didn't see the editor deleting blank lines between paragraphs where BBcode is not used (such as between the lines of your post), I assumed it was a thing specific to BBcode lists. So I searched the forums for threads that included both "BBcode" and "list", and those two threads didn't match.

Using the plain text editor doesn't change anything: even then, the blank lines get deleted as soon as you save. The two examples in my post above were entered using the plain text editor, and both behaved as I've described. I did a number of other tests with both the PTE and the WYSIWYG editor, and there doesn't seem to be any difference.

But I think you're right, this sounds like it has something to do with the issue in the HTML to BBcode conversion mentioned by Mike in the second thread. Perhaps it would be a good idea to merge this thread into that one, on the off chance my comments will help in solving the problem?

Thanks again for taking the time to elucidate this.
 
Going from memory here, but browsers have traditionally handled <br>'s in lists slightly differently. I believe I had it strip off one line due to that behavior. Changing it is somewhat of a big deal as it will break the historical formatting. As it does still allow you to add trailing breaks, I might leave it.

The issue of what happens when you edit is more related to the first bug, though I suppose that both bugs are related: HTML to BB code line break conversion. I'm going to mark this as a duplicate mostly because the issue from both of those bugs requires a full rewrite of the line break handling code, which would hopefully resolve this case as well.
 
Top Bottom