public static void main ( String [ ] args ) { // Compile the template. SoyFileSet sfs = SoyFileSet . builder ( ) . add ( Resources . getResource ( "simple.soy" ) ) . build ( ) ; SoyTofu tofu = sfs . compileToTofu ( ) ; // Example 1. writeExampleHeader ( ) ; System . out . println ( tofu . newRenderer ( "soy.examples.simple.helloWorld" ) . render ( ) ) ; // Create a namespaced tofu object to make calls more concise. SoyTofu simpleTofu = tofu . forNamespace ( "soy.examples.simple" ) ; // Example 2. writeExampleHeader ( ) ; System . out . println ( simpleTofu . newRenderer ( ".helloName" ) . setData ( ImmutableMap . of ( "name" , "Ana" ) ) . render ( ) ) ; // Example 3. writeExampleHeader ( ) ; System . out . println ( simpleTofu . newRenderer ( ".helloNames" ) . setData ( ImmutableMap . of ( "names" , ImmutableList . of ( "Bob" , "Cid" , "Dee" ) ) ) . render ( ) ) ; }
Prints the generated HTML to stdout .