On our site, we often have forum posts with multiple nested quotes, and sometimes these nested quotes are from multiple users. Eventually somewhere in the posts, a user will miss a closing quote tag. This causes the page HTML to become malformed, and the entire page becomes a jumbled mess of inappropriately placed CSS. As soon as a content editor fixes the missing quote tag, the page is fixed.
I would like to recommend a more graceful solution to this problem. I think it can be handled one of two ways. The first solution is a proactive approach. Once the user clicks "submit" on a comment, scan the body text and count the number of "[quote" tags and the number of "[/quote]" tags. (Note, I left the closing bracket off the open tag for situations where users have added the "=name".) If the number of [quote tags does not equal the number of [/quote] tags, return to the same page and present the user with an error message.
The second solution may change the intent of the post, but would be effective. Once the user clicks "submit" on a comment, scan the body text and count the number of "[quote" tags and the number of "[/quote]" tags. If the number of "[quote" tags is less than the number of "[/quote]" tags, add the difference as "[quote]" tags at the beginning of the post. if the number of "[/quote]" tags is less than the number of "[quote" tags, add the difference as "[/quote]" tags at the end of the post.
Using the second solution may cause quoted passages to no longer make sense, but at least we would avoid the errors.
Comments
Comment #1
Zen commentedThere are modules like HTML corrector for this.