[RFC|Accepted] Updated BBcode engine

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by brunoais »

EXreaction wrote:That could only happen if they upgrade and someone edits the post after the upgrade.
That's not true. All posts must be reevaluated from BBCode source. The way the system I'm making stores is imcompatible with the way the current system stores.
imkingdavid wrote: Well, we should at least prep the Support team for support requests about parts of a post not being displayed anymore.
Please do, if BBCode is being misused and generating wrong HTML it will be blown by my implementation.
JoshyPHP wrote:By the way, are there any existing tests for the current engine? All I see is one test in tests/bbcode/parser_test.php and a few cases in tests/bbcode/url_bbcode_test.php. I've looked into master and develop.
Don't worry I'm making more and remaking the existing one.
I just need to understand first how to make it working with as minimal resources as possible and without any errors.
JoshyPHP wrote:Ok, thanks. It would be nice if someone was able to compile a list of desirable characteristics, if not specs, for the current engine or future solution. It would be even better to sort them out as "essentials" (e.g. "needs to allow custom BBCodes"), "nice-to-haves", and perhaps even features that could be phased out such as per-style custom BBCode templates.
For now, what I'm really interested in is to make what I think that a BBCode parser should have/be and to solve all the bugs pointed out in the tickets that are associated to this BBCode's ticket. If you want to, for me, feel free to do that.
JoshyPHP wrote: Perhaps the fine people over at the 3.0.x Support Forum could chime in with the most common grievance about phpBB's BBCodes, or about the whole text formatting for that matter? MOD authors such as the authors of Advanced BBCode Box 3 may have some valuable input as well.
Yeah! That could be useful.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC|Accepted] Updated BBcode engine

Post by EXreaction »

We may not be able to convert all bbcodes over to a new system without problems. Check out the support toolkit and the bbcode reparser tool, we ran into many issues trying to reparse bbcode that users reported, but we were never able to figure out or reproduce.

Since that was such an issue, I'd suggest adding a flag to old parsed messages and using the old parser for those (which can be reparsed if edited by the user) and the new parser for new text.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by brunoais »

*Sniff* *sniff* smells like unknown installed MODs or details missing.

In that case, both parsers need to live alongside or we need to place a column with the parsed BBCode from the old parser.
It's not part of my intention to give support to the old parser for such stuff. Anyway, if you want me to take that approach, fine by me. I'll just give absolutely no support over the (hopefully) old BBCode parser (wanna be).
The more I investigate it the more patches and hammering I find they made to make it work.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC|Accepted] Updated BBcode engine

Post by EXreaction »

It could be that or just some server configuration we were not familiar with.

We could just add a column to indicate whether to use the new engine or the old (if you do not use bbcode bitfield we could use that). It's not ideal, but I'm afraid of what support issues we might run into if all upgrades try to convert to a new bbcode parser format and on some installations it fails entirely, destroying posts.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by brunoais »

OK... I'll buy that. In exchange (I only say that to look cool Image) I'd like to change how lists are... well... listed.

Currently the lists are made as:

Code: Select all

[list=1]
Wtf item
[*]Item1
item1
[*]item2
[*]item3
[/list]
Well... I'm makin' a parser that follows XML parsing rules. I have ways to parse this but they consume a butload of resources with checking and verifying, etc...
So, what I'm asking is to make the [li][/li] the new official BBCode for a list item and deprecate (not remove yet) the [*] as the official BBCode for the list item.
By making this I can optimize the parser such that it parses list items much much faster and without the need of extra logic in the list BBCode.
The problem is that the only way I found to properly parse the [*] is to break the parsing flow and to make further testing and recovering from misplaced [*] specially made for that tag. You bet that all that is a pain for the parser (not for me, the programmer).

Anyway, if one has a good idea about how the tag [*] can be taken care of, then pls do tell. I'm unable to come up with good ideas for parsing, for now.
Anyway, we may also use [*][/*], if you think it's better

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC|Accepted] Updated BBcode engine

Post by EXreaction »

I believe we want to be able to have simple tags, such as [*] which are not closed (there were other reasons besides lists for this, but I do not recall what).

Would it be possible to have your parser for lists handle it? You should be able to just have the bbcode parser ignore [*] (not make [*] a bbcode) and in the list parser you can parse it on its own.

It is a bit of a hack, but I'd much prefer not to alter existing bbcodes or users will be very confused.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by brunoais »

EXreaction wrote:Would it be possible to have your parser for lists handle it? You should be able to just have the bbcode parser ignore [*] (not make [*] a bbcode) and in the list parser you can parse it on its own.
It would be good if it was that simple. It is not, unfortunately. This is not a simple search and replace, there's real stuff here. With an opening and closing tag, all is executed in a very clean way. With just the opening tag, I believe I'll have to make something that is context free to find what it needs inside all that HTML. The problem is to make sure the output is valid HTML5 (and compatible with xHTML). I don't believe there's a straight forward way... I already thought about 3 different algorithms to make it but none are friendly enough.
They require regex or some context free parsing (something that is HTML tree aware). Any help?
SMF uses [li][/li] but even so... if the change is refused, then I'll make some hack-ish thing to allow it to work that way.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC|Accepted] Updated BBcode engine

Post by EXreaction »

I think a separate RFC for this would be appropriate so it is noticed.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC|Accepted] Updated BBcode engine

Post by callumacrae »

I'm pretty sure that [*]test[/*] is valid, why not just use that?
Made by developers, for developers!
My blog

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by brunoais »

Fine by me.
I'd prefer that it had always a closing tag...
'guess I'll have to dig up something to solve that in an efficient way. (as you probably know) If speed wasn't important here, I wasn't even mentioning this here.

Post Reply