Integrating s9e\TextFormatter in phpBB

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
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Integrating s9e\TextFormatter in phpBB

Post by JoshyPHP »

Preface

Earlier this year, I have announced in this forum the text formatting library I've been working on, s9e\TextFormatter. Since then, brunoais has agreed to take on the difficult task of cleaning up phpBB's current message parser and prepare to replace it with s9e\TextFormatter. In the meantime, I've been working on my side of things to make interfacing phpBB with s9e\TextFormatter as easy and painless as possible, and I've contributed a preliminary implementation of a phpBB-flavored formatter to brunoais's branch.

I'm going to use this topic to discuss some implementation details, as well as enquire about phpBB's ways. Items that need an official answer are marked with :?:. The rest is mainly about proactively dumping some information that brunoais will need when he'll get to it.

I haven't tagged this topic as a RFC because I'm not sure this is one, technically. If a proper RFC is needed I'll let brunoais author it and take ownership as I'm limiting my function to providing technical advice and as much glue code as needed.

The stuff
  • :?: In addition to the tokens available in phpBB, s9e\TextFormatter supports any number of custom tokens or variables in custom BBCodes. Some phpBB template variables (such as S_USER_LOGGED_IN) could be useful in custom BBCodes. Other template variables (such as T_SMILIES_PATH) are needed for some non-BBCode templates (e.g. emoticons.) Is there a way to get the values of those variables out of phpBB's template engine?
  • :?: I've mentionned S_USER_LOGGED_IN because of this topic. Users (not just phpBB's) often ask for BBCodes that hides content from anonymous users, bots, or sometimes from users that aren't members of a specific group. I can easily add support for the <!-- IF FOO --> syntax in custom BBCodes (as long as it's used wherever the comment would be legal) but I know that Twig support recently got merged and I'm unsure whether you're going to keep the old syntax. Seems like it's the case, but I'd rather know for sure than assume. Questions: should I add support for <!-- IF FOO --> or is that syntax now abandoned? Is there any variable other than S_USER_LOGGED_IN and S_IS_BOT that is worth adding? Any other kind of expression?
  • The behaviour of the {LOCAL_URL} token has recently changed to automatically change its value to prepend the board's URL at rendering time. s9e\TextFormatter doesn't modify values at rendering time, so I'm pondering how to implement it. The most likely solution will be to automatically insert a {BOARD_URL} token before {LOCAL_URL}. The real question is how and when to do it, as there's at least a couple of ways. The easiest route would be to transparently insert a {BOARD_URL} token before a {LOCAL_URL} token in the BBCode usage template, and transparently remove it when the BBCode is edited so that the user doesn't wonder what's going on.
  • phpBB has some optional limits on the number of URLs or smilies in a message. s9e\TextFormatter supports similar limits but they're meant to be set during configuration, not at parsing time. phpBB's limits depend on the $mode setting ('post', 'sig', not sure if there are any others.) One solution is to create one parser for each mode. The other is for me to implement changing those settings at parsing time.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: Integrating s9e\TextFormatter in phpBB

Post by naderman »

For the record, actual RFC ended up being discussed here: viewtopic.php?f=108&t=44467 So moving this to discussion.

Post Reply