Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
4011733d
Commit
4011733d
authored
Apr 13, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow nil user map
R=r DELTA=5 (3 added, 0 deleted, 2 changed) OCL=27371 CL=27389
parent
a9996d0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
template.go
src/lib/template/template.go
+5
-2
No files found.
src/lib/template/template.go
View file @
4011733d
...
...
@@ -48,6 +48,7 @@ const (
// FormatterMap is the type describing the mapping from formatter
// names to the functions that implement them.
// TODO(rsc): Maybe func should take interface{} instead?
type
FormatterMap
map
[
string
]
func
(
reflect
.
Value
)
string
// Built-in formatters.
...
...
@@ -446,8 +447,10 @@ func (t *template) evalVariable(name_formatter string) string {
}
val
:=
t
.
varValue
(
name
);
// is it in user-supplied map?
if
fn
,
ok
:=
t
.
fmap
[
formatter
];
ok
{
return
fn
(
val
)
if
t
.
fmap
!=
nil
{
if
fn
,
ok
:=
t
.
fmap
[
formatter
];
ok
{
return
fn
(
val
)
}
}
// is it in builtin map?
if
fn
,
ok
:=
builtins
[
formatter
];
ok
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment