[buddypress-trac] [BuddyPress Trac] #6921: Maybe introduce PHP Mustache parser for email templates

buddypress-trac noreply at wordpress.org
Sat Mar 24 21:11:17 UTC 2018


#6921: Maybe introduce PHP Mustache parser for email templates
----------------------------+-----------------------
 Reporter:  Paul Gibbs      |       Owner:  (none)
     Type:  enhancement     |      Status:  reopened
 Priority:  normal          |   Milestone:  Up Next
Component:  Emails          |     Version:  2.5.0
 Severity:  normal          |  Resolution:
 Keywords:  trac-tidy-2018  |
----------------------------+-----------------------

Comment (by r-a-y):

 @djpaul - Thanks for the refresh.

 I had a chance to play around with the LightnCandy patch and
 unfortunately, our usage of mustasche tokens are incompatible with the
 official Mustasche syntax:
 https://zordius.github.io/HandlebarsCookbook/0013-dotnotation.html

 For example, take the token, `{{poster.name}}`.

 We pass on the token in BuddyPress like this:

 `array( 'poster.name' => 'foo' )`

 Mustasche / LightnCandy expects this:

 `array( 'poster => array( 'name' => 'foo' ) )`

 We could switch to the latter syntax internally, but we would also break
 all 3rd-party plugins using BP HTML and tokens using dot notation.

 `03.patch` does some backward-compatibility token parsing to ensure we can
 support the older syntax up to one-level of dot notation (`poster.name`
 would convert to the new syntax, but `poster.name.surname` wouldn't as we
 haven't used tokens with two dots internally).

 Patch passes existing unit tests.

 Note: I haven't switched up all of our internal tokens to use the new
 token syntax yet.

 Also, in the patch, I've removed the usage of the `use` keyword since I
 would rather this be used for namespaced classes.  This isn't a sticking
 point for me though.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6921#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list