Rick

Rick
Rick

Sunday, June 10, 2012

Got basic iteration added to Java template engine. Java code (note you can use format and lines instead of fmt and lns).
  String st = fmt(
    lns("This is a test of my sanity",
     "This is a test of my sanity",
     "{@loop:test.emps} ",
     "This is the body of the loop",
     "firstName = {iter.firstName}",
     "{@endloop}",
     "This text is outside of the loop"
      )
    ,
    mp("test",
      mp("emps",
        ls(emp("Rick", "Hightower", 1000.0),
          emp("Bob", "Hightower", 7000.0)))));
  print("fmt18", st);

Output:
fmt18 This is a test of my sanity
This is a test of my sanity
 
This is the body of the loop
firstName = Rick
 
This is the body of the loop
firstName = Bob
This text is outside of the loop

I also got formatting working last night. I think I am done for a while. I had my fun.

No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training