diff options
author | James Meneghello <rawrz0r@gmail.com> | 2009-11-19 21:08:05 -0800 |
---|---|---|
committer | James Meneghello <rawrz0r@gmail.com> | 2009-11-19 21:08:05 -0800 |
commit | 685eac5e26250e4d9b795d1b2baf4bdcbd4939b9 (patch) | |
tree | abe1a7cdfa2aa0e1ee5bd4ad479520c8f39148ed /lib/codereview/codereview.py | |
parent | 0e9a31a3439b63820d967ae09229ddc9b45ed540 (diff) | |
download | golang-685eac5e26250e4d9b795d1b2baf4bdcbd4939b9.tar.gz |
Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.
-Psuedocode-
mp map[string]string = {
"header" : "A fantastic header!",
"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)
...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:
type s struct {
mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)
...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.
Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.
Fixes issue 259.
R=r, rsc
http://codereview.appspot.com/157088
Committer: Rob Pike <r@golang.org>
Diffstat (limited to 'lib/codereview/codereview.py')
0 files changed, 0 insertions, 0 deletions