#import "Basic"; #import "htmltemplate"(); /** jai 01_from_readme.jai -quiet && ./01_from_readme */ TEMPLATE :: #string STR_END
STR_END; main :: () { queue_action: [..]Action; defer array_free(queue_action); commit("foo1", "My Title"); commit("foo2", "#about", "target=\"_self\"", "About"); commit("foo3", "blog", "_self"); commit("foo4", .[ .["Foo", "Bar"], .["Fizz", "Buzz"], .["contact", ""], ]); success, html_string, exit_code, error_message := generate(queue_action, TEMPLATE, .STRING); defer { free(html_string); free(error_message); } if !success { log("%", error_message); return; } log("%", html_string); }