What you just wrote reminds me of CAP. (It's a model for distributed systems. You cannot have "perfect" availability, consistency and partition tolerance at the same time)JoshyPHP wrote:In an ideal world, it would go like this:
- have an editor that never produces junk
- if junk is found, alert the user
- if there's no user, fasten your seat belt and prepare for a crash landing. IOW, transform the junk into something that won't break the page
With BBCode parsers you cannot have:
Fix all user mistakes silently and never produce junk text.
Parse all BBCode from any source bulletin board and its own BBCode rules and expect for it to work exactly the same way everywhere.
On another subject. I did some tests using zero-length tags*1 and it seems like it is the answer to many of the problems the parser is required to solve that it does not solve yet.
From what I understood, the current parser is required to (silently or not*2) fix some mis-nested tags. Example:
Code: Select all
[i]ab[b]cd[/i]ef[/b]
becomes:
ab cd ef
OR
ab cd ef
Code: Select all
[quote][url]abc[/quote][/url]
becomes (simplified):
[url]abc [/url]
*1 It does make sense for my parser, anyway if you want some clarification, I can try to explain why it accepts such thing.
*2 I still need to understand if errors should be reported to the user or not. I tested in multiple BB's and only one of them ever reports mistakes back to the user. All others (that use BBCode) will somehow try to fix or they just ignore malformed BBCode.
It is actually possible to make a parser that will not allow a post to break the page.JoshyPHP wrote: In an ideal world, it would go like this:
(...)
- if there's no user, fasten your seat belt and prepare for a crash landing. IOW, transform the junk into something that won't break the page
What's impossible is to make a parser that guarantees that the page will stay intact and that fixes any mistakes made by the user.
Flagging errors with any markup is not a trivial task. Specially because after the 1st broken thing, any errors it tries to find are not reliable.Pony99CA wrote: I agree with that 100%. Maybe the BBCode parser will take an option that specifies if a user entered the BBCode or not (for example, it's going through a converter). If a user entered it, flag the error; otherwise, try to emit something valid.
I was going into that one, but seems like the "big guys" don't want it... I don't blame 'em it, somewhat, makes sense. It's called backwards compatibility.Pony99CA wrote:In my opinion, yes. It's no different than somebody creating a new post with invalid markup.callumacrae wrote:Re the error, what happens when a user edits a post made before 3.1? Will they have to fix the markup before they can submit the edited post?