Lotus TemplateLotus Template is a methodology for merging data, via a JSON formatted object, with a template written in a completely language agnostic form. The template file contains no complex logic or other code intermixed with the template; this allows the rendering engine to smartly do the right thing during its processing of the data and the template. LT is a methodology and not a specific implementation because it can be implemented in many ways and in many languages. The first language to implement the LTM is javascript followed shortly thereafter by PHP. Plans are in the works for a Python, Ruby, and C# translation as well. The template need not necessarily be outputting HTML; it could just as well return plain text, or a CSV string. Design PriciplesEverything is done for a reason. Simple Implementation CodeThe goal of this methodology is to not only to merge the data with the template but also allow the developer the chance to understand the code they are including in their work. Hopefully the redering engines are simple enough that after scanning the code briefly it may be grasped quite simply. No Rendered FunctionalityKeeping the scope of this methodology simple and easy to grasp should also permit the exclusion of string built function definitions and the use of eval to create functionality at runtime. Therefore there will be no complex logic in the template file that will need special evaluation. No KeywordsThis is not meant to become a new programming language and compiler. There is need for a few key-symbols to denote begging and endings of blocks as well as some scope modifiers. - (caret) "^" - for accessing a parent node
- (dot) "." - for accessing a child node
- (else) "?" - used to indicate else block
- (hash) "#" - accesses the index/key of an Array/Object
- (double-hash) "##" - accesses the value of an Array item or Object property at the current item
- (slash) "/" - denotes the end of a block
|