I too, would love to omit bad tags from the output, but I haven't found a way that works reliably. I believe it's a problem that does not have a definitive solution. I've sunk a lot of time thinking about it while developing the library, and we could collectively sink a lot more without any actual progress. The only way to definitively eliminate bad markup is to not use markup. Unfortunately, rich text editors come with their own set of challenges and shortcomings. So we're stuck with imperfect solutions such as the ones we're discussing.Pony99CA wrote:I hate seeing unrendered tags in posts
In this case, what will that user do when presented with an error message? Go back and fix the text, click the button that says "I don't care, post anyway" or give up on posting the message altogether?Pony99CA wrote:Worse,if he's too lazy to Preview his post, he's probably not going to look at it after he posts
As a reminder, the default behaviour in s9e\TextFormatter would be to disable the quote tag in that context. Currently, the one way to achieve what you describe would be to manually add a rule that says "quote tags close bold tags" and that would need to be replicated for every tag that you want closed automatically. At some point in the future, it should be possible to add only one global rule that says "all block tags should close non-block tags" and I'd love to get ideas about that. Not just about phpBB, but in general. Because even though "all block tags should close non-block tags" sounds good, it doesn't mean anything in HTML5 because there's no such thing as a block tag. The concept of block elements vs inline elements dates from HTML4 and found its way in CSS as the "display" attribute but even in CSS it's not that clear. For instance, tables are not blocks, they're "display: table".imkingdavid wrote:I'd say we go with option 1 steve chose and just insert a bold tag directly prior to the quote tag. IMO that is the best option in such a case.
The default behaviour in s9e\TextFormatter is to open tags even if they don't have an end tag immediately apparent. The main reason is that not every tag has to be explicitely closed, such asimkingdavid wrote:EDIT: We could just do what we do now with the unclosed tag in the first paragraph of this post: nothing. Don't parse it. Leave it be.
[*]or in some other commenting systems
[hr]and other similar tags. This can be changed on a per-BBCode basis using an option named forceLookahead, which forces the BBCodes parser to look ahead in the text for a potential closing tag. Unlike most rules, s9e\TextFormatter doesn't have an automated way to set this option based on templates.
Master_Cylinder wrote:What about cases where they try to quote inside of bold though? Shouldn't it be smart enough to close the bold and then restart the after the close quote?
Currently that's not possible, but that's definitely something I'll consider adding to s9e\TextFormatter even if it's not used in phpBB. I'd have to think about it because I'm afraid of bad interactions between tags being automatically closed and tags being automatically reopened; I wouldn't want to create a repeating loop, even though there are safeguards in place that would limit it to "only" a few hundreds extraneous tags rather than a CPU-melting, memory-hogging, infinite loop.