ejs icon indicating copy to clipboard operation
ejs copied to clipboard

The ejs should modify its parse() method add tag syntax support

Open ifishing opened this issue 12 years ago • 0 comments

The tag pair syntax has many benefits in template engine. It make the template seems more like html and more readable.In the famous PHP template engine Smarty , you could see many tag usage. Now the ejs engine use <%=$var%> and <%-$var%> to output the content of variable &var.If the first char in a ejs statement is not = or - , it will be recognized as js code. So the current parse mechanisms don't support tag parsing. The tag written in ejs would be recognized as common js code.We need to modify the parse() method to recognize tag and execute the tag processing. One of the scheme is to force no blank between tag and pre-delimiter.If it has blank (such as white spacse) between the pre-delimeter and the later ejs statement ,the statement should be parsed as common javascript code. If you take this suggestion, I can take the task of coding.

ifishing avatar Apr 23 '13 16:04 ifishing