Allow multiple cgen buffers.

This commit is contained in:
Nigel Tao committed 2017-08-26 16:51:53 +10:00
1 parent f839603198
commit c7fe1fd8c1
4 files changed
+583 -557

No files matched your search

+2 -2
View File
@@ -115,8 +115,8 @@ func genTemplates(out *bytes.Buffer) error {
}
}
fmt.Fprintf(out, "}\n\n")
fmt.Fprintf(out, "func template_%s(g *gen, args template_args_%s) error {\n", t.name, t.name)
fmt.Fprintf(out, "g.printf(%q,\n", t.format)
fmt.Fprintf(out, "func template_%s(b *buffer, args template_args_%s) error {\n", t.name, t.name)
fmt.Fprintf(out, "b.printf(%q,\n", t.format)
for _, a := range t.formatArgs {
fmt.Fprintf(out, "args.%s,\n", stripq(a))
}