hugo_template.go (1228B)
1 // Copyright 2019 The Hugo Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 package template
15
16 import (
17 template "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate"
18 )
19
20 /*
21
22 This files contains the Hugo related addons. All the other files in this
23 package is auto generated.
24
25 */
26
27 // Export it so we can populate Hugo's func map with it, which makes it faster.
28 var GoFuncs = funcMap
29
30 // Prepare returns a template ready for execution.
31 func (t *Template) Prepare() (*template.Template, error) {
32 if err := t.escape(); err != nil {
33 return nil, err
34 }
35 return t.text, nil
36 }
37
38 // See https://github.com/golang/go/issues/5884
39 func StripTags(html string) string {
40 return stripTags(html)
41 }