(args ...interface{})
| 1197 | var templateIDserver = "tmpl/momentum/server.tmpl" |
| 1198 | |
| 1199 | func Netserver(args ...interface{}) string { |
| 1200 | |
| 1201 | localid := templateIDserver |
| 1202 | var d *gosweb.NoStruct |
| 1203 | defer templateFNserver(localid, d) |
| 1204 | if len(args) > 0 { |
| 1205 | jso := args[0].(string) |
| 1206 | var jsonBlob = []byte(jso) |
| 1207 | err := json.Unmarshal(jsonBlob, d) |
| 1208 | if err != nil { |
| 1209 | return err.Error() |
| 1210 | } |
| 1211 | } else { |
| 1212 | d = &gosweb.NoStruct{} |
| 1213 | } |
| 1214 | |
| 1215 | output := new(bytes.Buffer) |
| 1216 | |
| 1217 | if _, ok := templateCache.Get(localid); !ok || !Prod { |
| 1218 | |
| 1219 | body, er := Asset(localid) |
| 1220 | if er != nil { |
| 1221 | return "" |
| 1222 | } |
| 1223 | var localtemplate = template.New("server") |
| 1224 | localtemplate.Funcs(TemplateFuncStore) |
| 1225 | var tmpstr = string(body) |
| 1226 | localtemplate.Parse(tmpstr) |
| 1227 | body = nil |
| 1228 | templateCache.Put(localid, localtemplate) |
| 1229 | } |
| 1230 | |
| 1231 | erro := templateCache.JGet(localid).Execute(output, d) |
| 1232 | if erro != nil { |
| 1233 | color.Red(fmt.Sprintf("Error processing template %s", localid)) |
| 1234 | DebugTemplatePath(localid, d) |
| 1235 | } |
| 1236 | var outps = output.String() |
| 1237 | var outpescaped = html.UnescapeString(outps) |
| 1238 | d = nil |
| 1239 | output.Reset() |
| 1240 | output = nil |
| 1241 | args = nil |
| 1242 | return outpescaped |
| 1243 | |
| 1244 | } |
| 1245 | func bserver(d gosweb.NoStruct) string { |
| 1246 | return Netbserver(d) |
| 1247 | } |
no test coverage detected