Perfect
Perfect copied to clipboard
Moustache: empty comments cause parsing error
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.
It's pronounced "Mustache".
I'll let myself out.
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