%q
to quote a string in fmt.Sprintf
format specifiers GO-R4002316 commentStr += `
317`
318 }
319 commentStr += fmt.Sprintf(`// "%s" => http://localhost:9033/admin/info/%s`, lowerTable, lowerTable)320 }
321 }
322
114 if compo.Style == "" {
115 compo.Style = template.HTMLAttr(fmt.Sprintf(`style="%s"`, compo.Padding))
116 } else {
117 compo.Style = template.HTMLAttr(fmt.Sprintf(`style="%s"`, string(compo.Style)+compo.Padding))118 }
119
120 return ComposeHtml(compo.TemplateList, compo.Separation, *compo, "box")
112func (compo *BoxAttribute) GetContent() template.HTML {
113
114 if compo.Style == "" {
115 compo.Style = template.HTMLAttr(fmt.Sprintf(`style="%s"`, compo.Padding))116 } else {
117 compo.Style = template.HTMLAttr(fmt.Sprintf(`style="%s"`, string(compo.Style)+compo.Padding))
118 }
207 return
208 }
209
210 ctx.HTML(http.StatusOK, fmt.Sprintf(`<script>location.href="%s"</script>`, param.PreviousPath))211 ctx.AddHeader(constant.PjaxUrlHeader, param.PreviousPath)
212 return
213 }
148 return
149 }
150
151 ctx.HTML(http.StatusOK, fmt.Sprintf(`<script>location.href="%s"</script>`, param.PreviousPath))152 ctx.AddHeader(constant.PjaxUrlHeader, param.PreviousPath)
153 return
154 }
%q
is same as "%s"
.
str := fmt.Sprintf("str: "%s"", "Hello World")
// str => str: "Hello World"
str := fmt.Sprintf("str: %q", "Hello World")
// str => str: "Hello World"