name mode size
MulleScionTemplates.xcodeproj 040000
dox 040000
src 040000
.gitignore 100644 116B
LICENSE 100644 1.54kB
README 100644 3.15kB
README
MulleScionTemplates is a modern template engine for Objective C (written in an oldfashioned way) It's heavily (very heavily) inspired by TWIG "The flexible, fast, and secure template engine for PHP" "http://twig.sensiolabs.org/" MulleScionTemplates is fairly flexible, reasonably fast and can be made as secure as you wish. Reasonably Fast: MulleScion can compile templates into a compressed archive format. Loading such an archive is lots faster than parsing. A compiled template is read-only, you can use it many times to render different output from different input. Secure: MulleScion has hooks so your application can ensure that untrusted template code doesn't have access to all of the input data. Flexible: There is the possibility of extending KVC and writing your own "builtin" fuctions. A template can (if allowed) execute arbitrary ObjC code. MulleScion has a powerful #define like preprocessing capability. Using the MulleScionTemplates.framework the creation of a string from your object using a template file is as easy as: NSString *output; output = [MulleScionTemplate descriptionWithTemplateFile:@"test.scion" dataSource:self]; MulleScionTemplates is a work in progress, but it looks good to me. DOCUMENTATION ============= mulle-scion contains a little webserver that hosts the documentation contained in dox, when copied to /tmp. Virtually all the documentation is contained in those example .scion templates in the dox folder. For each command or feature there should be a separate template file that documents it. The documentation is not very good, actually it is just more or less a collection of test cases with comments... MulleScion is very similar to TWIG, so you can glean much of relevance from http://twig.sensiolabs.org. If you see a feature in TWIG but don't see it in the tests file, it's not there (but it's probably easily achieved some other way (define, macro, ObjC category on NSString). LIMITATIONS ============= Because you can execute arbitrary ObjC methods, and have access to Key Value Coding, MulleScion can pretty much do anything. MulleScionTemplates use NSInvocation for method calls, and that usually can not do variable arguments. So that will be a problem. Be wary of anything using structs and C-Arrays and C-strings, although MulleScionTemplates tries to be as helpful as possible. MulleScionTemplates do not do arithmetic or bitwise logic, quite on purpose. MulleScionTemplates do not support the @{ } syntax to create dictionaries. MulleScionTemplates && and || have no operator precedence, use parentheses MulleScionTemplates don't prevent you from trying stupid things. TODO ============= Would be nice to have delayed evaluation for render results. Get rid of MulleScionNull except for printing a nil value. AUTHOR ============= Coded by Nat! 2013 Mulle kybernetiK Mongoose Webserver by Sergey Lyubka