mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-08-21 15:11:48 +02:00
Upgrade unrolled/render to v1.1.1 (#15845)
This commit is contained in:
parent
ec2addc0ed
commit
b61092bcb0
2
go.mod
2
go.mod
|
@ -105,7 +105,7 @@ require (
|
||||||
github.com/unknwon/com v1.0.1
|
github.com/unknwon/com v1.0.1
|
||||||
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44
|
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44
|
||||||
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
|
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
|
||||||
github.com/unrolled/render v1.1.0
|
github.com/unrolled/render v1.1.1
|
||||||
github.com/urfave/cli v1.22.5
|
github.com/urfave/cli v1.22.5
|
||||||
github.com/willf/bitset v1.1.11 // indirect
|
github.com/willf/bitset v1.1.11 // indirect
|
||||||
github.com/xanzy/go-gitlab v0.48.0
|
github.com/xanzy/go-gitlab v0.48.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1099,8 +1099,8 @@ github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44 h1:7bSo/vjZKVYUoZfxpY
|
||||||
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
|
github.com/unknwon/i18n v0.0.0-20210321134014-0ebbf2df1c44/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
|
||||||
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae h1:ihaXiJkaca54IaCSnEXtE/uSZOmPxKZhDfVLrzZLFDs=
|
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae h1:ihaXiJkaca54IaCSnEXtE/uSZOmPxKZhDfVLrzZLFDs=
|
||||||
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae/go.mod h1:1fdkY6xxl6ExVs2QFv7R0F5IRZHKA8RahhB9fMC9RvM=
|
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae/go.mod h1:1fdkY6xxl6ExVs2QFv7R0F5IRZHKA8RahhB9fMC9RvM=
|
||||||
github.com/unrolled/render v1.1.0 h1:gvpR9hHxTt6DcGqRYuVVFcfd8rtK+nyEPUJN06KB57Q=
|
github.com/unrolled/render v1.1.1 h1:FpzNzkvlJQIlVdVaqeVBGWiCS8gpbmjtrKpDmCn6p64=
|
||||||
github.com/unrolled/render v1.1.0/go.mod h1:gN9T0NhL4Bfbwu8ann7Ry/TGHYfosul+J0obPf6NBdM=
|
github.com/unrolled/render v1.1.1/go.mod h1:gN9T0NhL4Bfbwu8ann7Ry/TGHYfosul+J0obPf6NBdM=
|
||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||||
|
|
27
vendor/github.com/unrolled/render/render.go
generated
vendored
27
vendor/github.com/unrolled/render/render.go
generated
vendored
|
@ -123,7 +123,7 @@ type Render struct {
|
||||||
// Customize Secure with an Options struct.
|
// Customize Secure with an Options struct.
|
||||||
opt Options
|
opt Options
|
||||||
templates *template.Template
|
templates *template.Template
|
||||||
templatesLk sync.Mutex
|
templatesLk sync.RWMutex
|
||||||
compiledCharset string
|
compiledCharset string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ func (r *Render) compileTemplates() {
|
||||||
|
|
||||||
func (r *Render) compileTemplatesFromDir() {
|
func (r *Render) compileTemplatesFromDir() {
|
||||||
dir := r.opt.Directory
|
dir := r.opt.Directory
|
||||||
r.templates = template.New(dir)
|
tmpTemplates := template.New(dir)
|
||||||
r.templates.Delims(r.opt.Delims.Left, r.opt.Delims.Right)
|
tmpTemplates.Delims(r.opt.Delims.Left, r.opt.Delims.Right)
|
||||||
|
|
||||||
// Walk the supplied directory and compile any files that match our extension list.
|
// Walk the supplied directory and compile any files that match our extension list.
|
||||||
r.opt.FileSystem.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
r.opt.FileSystem.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||||
|
@ -227,7 +227,7 @@ func (r *Render) compileTemplatesFromDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
name := (rel[0 : len(rel)-len(ext)])
|
name := (rel[0 : len(rel)-len(ext)])
|
||||||
tmpl := r.templates.New(filepath.ToSlash(name))
|
tmpl := tmpTemplates.New(filepath.ToSlash(name))
|
||||||
|
|
||||||
// Add our funcmaps.
|
// Add our funcmaps.
|
||||||
for _, funcs := range r.opt.Funcs {
|
for _, funcs := range r.opt.Funcs {
|
||||||
|
@ -241,12 +241,16 @@ func (r *Render) compileTemplatesFromDir() {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.templatesLk.Lock()
|
||||||
|
r.templates = tmpTemplates
|
||||||
|
r.templatesLk.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Render) compileTemplatesFromAsset() {
|
func (r *Render) compileTemplatesFromAsset() {
|
||||||
dir := r.opt.Directory
|
dir := r.opt.Directory
|
||||||
r.templates = template.New(dir)
|
tmpTemplates := template.New(dir)
|
||||||
r.templates.Delims(r.opt.Delims.Left, r.opt.Delims.Right)
|
tmpTemplates.Delims(r.opt.Delims.Left, r.opt.Delims.Right)
|
||||||
|
|
||||||
for _, path := range r.opt.AssetNames() {
|
for _, path := range r.opt.AssetNames() {
|
||||||
if !strings.HasPrefix(path, dir) {
|
if !strings.HasPrefix(path, dir) {
|
||||||
|
@ -272,7 +276,7 @@ func (r *Render) compileTemplatesFromAsset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
name := (rel[0 : len(rel)-len(ext)])
|
name := (rel[0 : len(rel)-len(ext)])
|
||||||
tmpl := r.templates.New(filepath.ToSlash(name))
|
tmpl := tmpTemplates.New(filepath.ToSlash(name))
|
||||||
|
|
||||||
// Add our funcmaps.
|
// Add our funcmaps.
|
||||||
for _, funcs := range r.opt.Funcs {
|
for _, funcs := range r.opt.Funcs {
|
||||||
|
@ -285,6 +289,10 @@ func (r *Render) compileTemplatesFromAsset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.templatesLk.Lock()
|
||||||
|
r.templates = tmpTemplates
|
||||||
|
r.templatesLk.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TemplateLookup is a wrapper around template.Lookup and returns
|
// TemplateLookup is a wrapper around template.Lookup and returns
|
||||||
|
@ -389,14 +397,15 @@ func (r *Render) Data(w io.Writer, status int, v []byte) error {
|
||||||
|
|
||||||
// HTML builds up the response from the specified template and bindings.
|
// HTML builds up the response from the specified template and bindings.
|
||||||
func (r *Render) HTML(w io.Writer, status int, name string, binding interface{}, htmlOpt ...HTMLOptions) error {
|
func (r *Render) HTML(w io.Writer, status int, name string, binding interface{}, htmlOpt ...HTMLOptions) error {
|
||||||
r.templatesLk.Lock()
|
|
||||||
defer r.templatesLk.Unlock()
|
|
||||||
|
|
||||||
// If we are in development mode, recompile the templates on every HTML request.
|
// If we are in development mode, recompile the templates on every HTML request.
|
||||||
if r.opt.IsDevelopment {
|
if r.opt.IsDevelopment {
|
||||||
r.compileTemplates()
|
r.compileTemplates()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.templatesLk.RLock()
|
||||||
|
defer r.templatesLk.RUnlock()
|
||||||
|
|
||||||
opt := r.prepareHTMLOptions(htmlOpt)
|
opt := r.prepareHTMLOptions(htmlOpt)
|
||||||
if tpl := r.templates.Lookup(name); tpl != nil {
|
if tpl := r.templates.Lookup(name); tpl != nil {
|
||||||
if len(opt.Layout) > 0 {
|
if len(opt.Layout) > 0 {
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -743,7 +743,7 @@ github.com/unknwon/i18n
|
||||||
# github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
|
# github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
|
||||||
## explicit
|
## explicit
|
||||||
github.com/unknwon/paginater
|
github.com/unknwon/paginater
|
||||||
# github.com/unrolled/render v1.1.0
|
# github.com/unrolled/render v1.1.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/unrolled/render
|
github.com/unrolled/render
|
||||||
# github.com/urfave/cli v1.22.5
|
# github.com/urfave/cli v1.22.5
|
||||||
|
|
Loading…
Reference in a new issue