Nu Class Reference

NuTemplate

Text templates for Nu.

Superclass: NSObject
Declared in: nu/template.nu

Similar to Ruby's "embedded Ruby" (aka "erb"), this allows Nu expressions to be used in templates to simplify programmatic generation of text in arbitrary formats. Applications include generation of HTML, CSS, and Objective-C source code. Like Ruby's "erb", expressions surrounded by <%= and %> are evaluated and replaced by their string values and code surrounded by <% and %> is treated as embedded Nu code.

Methods

+ (id) scriptForString: (id) template
Take a string corresponding to a template and generate a string that can be parsed and evaluated to generate the desired text. The returned string should be evaluated in a context that defines all symbols referenced in the template.

in nu/template.nu

+ (id) codeForString: (id) template
Take a string corresponding to a template and generate code (parsed s-expressions) that can be evaluated to generate the desired text. The returned code should be evaluated in a context that defines all symbols referenced in the template.

in nu/template.nu

+ (id) codeForFileNamed: (id) fileName
Read a template from a file and return a code object to be evaluated to generate the desired text.

in nu/template.nu

+ (id) scriptForFileNamed: (id) fileName
Read a template from a file and return a string to be parsed and evaluated to generate the desired text.

in nu/template.nu