code refacturing, added render package comments
This commit is contained in:
@ -15,33 +15,24 @@ func Add_api(w http.ResponseWriter, req *http.Request) {
|
||||
fmt.Fprintf(w, "good")
|
||||
}
|
||||
|
||||
func Show_apis(w http.ResponseWriter, req *http.Request) {
|
||||
apis := api.Apis()
|
||||
eval := "<div>"
|
||||
for tag, varr := range apis {
|
||||
eval_group := ""
|
||||
eval_group += fmt.Sprintf("%v", varr)
|
||||
eval_group += "-"
|
||||
eval_group += tag
|
||||
eval_group += "<br>"
|
||||
eval += render.Template_of_tag(eval_group, "text")
|
||||
}
|
||||
eval += "</div>"
|
||||
|
||||
fmt.Fprint(w, render.Template_with_string(eval))
|
||||
}
|
||||
|
||||
func Render_apis(w http.ResponseWriter, req *http.Request) {
|
||||
apis := api.Apis()
|
||||
eval := "<div>"
|
||||
eval := ""
|
||||
i := 0
|
||||
for tag, varr := range apis {
|
||||
eval_group := ""
|
||||
eval_group += tag
|
||||
eval_group += "-"
|
||||
eval_group += "<br>-"
|
||||
eval_group += fmt.Sprintf("%v", varr)
|
||||
eval_group += "<br>"
|
||||
eval += eval_group
|
||||
|
||||
eval += render.Put_vars_to_template(
|
||||
render.Template_of_tag("li"),
|
||||
lib.Map_args("li_id", fmt.Sprint(i), "content", eval_group))
|
||||
i++
|
||||
}
|
||||
eval += "</div>"
|
||||
fmt.Fprint(w, render.Put_vars_to_template(render.Template_with_part("json_out"), lib.Map_args("json_code", eval)))
|
||||
fmt.Fprint(w,
|
||||
render.Put_vars_to_template(
|
||||
render.Template_of_part("json_out_as_list"),
|
||||
lib.Map_args("li_from_json_code", eval)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user