From ebf2b92e9a7fe7f8de079d8aa76fe88f89dee02b Mon Sep 17 00:00:00 2001
From: Rob Pike templ.Execute
, in this case the
form value.
Within the template text (templateStr
),
double-brace-delimited pieces denote template actions.
-The piece from the executes only if the value of the current data item, called
.
,
+The piece from the {{if .}}
+to {{end}}
executes only if the value of the current data item, called .
(dot),
is non-empty.
That is, when the string is empty, this piece of the template is suppressed.
-The snippet 0
says to process the data with the function
+The snippet {{urlquery .}}
says to process the data with the function
urlquery
, which sanitizes the query string
for safe display on the web page.
templ.Execute
, in this case the
form value.
Within the template text (templateStr
),
double-brace-delimited pieces denote template actions.
-The piece from the {{if .}}
-to {{end}}
executes only if the value of the current data item, called .
,
+The piece from the {{html "{{if .}}"}}
+to {{html "{{end}}"}}
executes only if the value of the current data item, called .
(dot),
is non-empty.
That is, when the string is empty, this piece of the template is suppressed.
-The snippet {{urlquery .}}
says to process the data with the function
+The snippet {{html "{{urlquery .}}"}}
says to process the data with the function
urlquery
, which sanitizes the query string
for safe display on the web page.