ExecuteFuncString calls f on each template tag (placeholder) occurrence and substitutes it with the data written to TagFunc's w. Returns the resulting string. This function is optimized for frozen templates. Use ExecuteFuncString for constantly changing templates.
(f TagFunc)
| 168 | // This function is optimized for frozen templates. |
| 169 | // Use ExecuteFuncString for constantly changing templates. |
| 170 | func (t *Template) ExecuteFuncString(f TagFunc) []byte { |
| 171 | bb := t.byteBufferPool.Get() |
| 172 | if _, err := t.ExecuteFunc(bb, f); err != nil { |
| 173 | return []byte{} |
| 174 | } |
| 175 | s := bb.Bytes() |
| 176 | bb.Reset() |
| 177 | t.byteBufferPool.Put(bb) |
| 178 | return s |
| 179 | } |
| 180 | |
| 181 | // ExecuteString substitutes template tags (placeholders) with the corresponding |
| 182 | // values from the map m and returns the result. |
no test coverage detected