Perfect icon indicating copy to clipboard operation
Perfect copied to clipboard

Moustache: empty comments cause parsing error

Open kjessup opened this issue 9 years ago • 2 comments

The following works: {{% handler:FAHandler}}{{! This is the moustache template file }}{"resultSets":[{{#resultSets}}{"time":"{{time}}","lat":{{lat}},"long":{{long}} }{{^last}},{{/last}}{{/resultSets}}]}

While this causes parsing problems:

{{% handler:FAHandler}}{{!

}}{"resultSets":[{{#resultSets}}{"time":"{{time}}","lat":{{lat}},"long":{{long}} }{{^last}},{{/last}}{{/resultSets}}]}

The system skips the closing empty comment delimiters.

kjessup avatar Oct 27 '15 20:10 kjessup

It's pronounced "Mustache".

I'll let myself out.

SeanStephens avatar Nov 24 '15 01:11 SeanStephens

I believe this comes from the code that tries to trim trailing whitespace in Mustache tag names, which doesn't check if there actually are any unicode scalars before using them: https://github.com/PerfectlySoft/Perfect/blob/master/PerfectLib/Mustache.swift#L740

C0deH4cker avatar Dec 16 '15 08:12 C0deH4cker