4
我在Google App Engine上使用Google Go。我现在的储蓄结构中的string
描述成datastore
,像这样:Golang GAE - HTML模板未正确插入链接到网页
type Foo struct{
Bar string
}
这说明包括HTML标签,例如:
<a href="/">Bar</a>
我想html template
包括在HTML这样的描述文件,所以它会被解析为html。例如:
<html><head><title>Title</title></head>
<body>{{.Bar}}</body></html>
被解析为:
<html><head><title>Title</title></head>
<body><a href="/">Bar</a></body></html>
,而是,我得到的是这样的:
<html><head><title>Title</title></head>
<body><a href="/">Bar's</a></body></html>
我怎样才能让template
正确解析string
成html链接?
对于第二部分 - '美孚Foo.Bar'的'[ “酒吧”]'? – ThePiachu
@ThePiachu是的,它应该是'Foo.Bar' –