lang/interpret_test/TestAstFunc2/template-0.txtar
raw| 1 | -- main.mcl -- |
| 2 | import "datetime" |
| 3 | import "golang" |
| 4 | |
| 5 | $secplus42 = 42 + $ayear |
| 6 | |
| 7 | # note the order of the assignment (year can come later in the code) |
| 8 | $ayear = 60 * 60 * 24 * 365 # is a year in seconds (31536000) |
| 9 | |
| 10 | $tmplvalues = struct{time => $secplus42, hello => "world",} |
| 11 | |
| 12 | print "template-0" { |
| 13 | msg => golang.template("Hello: {{ .hello }}, 42 sec + 1 year is: {{ .time }} seconds, aka: {{ datetime_print .time }}", $tmplvalues), |
| 14 | } |
| 15 | -- OUTPUT -- |
| 16 | Vertex: print[template-0] |