bugfix and some docs cleanup
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
6586db782e
commit
f569df6ead
|
@ -75,7 +75,7 @@ func DirectoryDefault(fileSystem fs.FS, fileNames ...string) gus.Handler {
|
||||||
func DirectoryListing(fileSystem fs.FS, template *template.Template) gus.Handler {
|
func DirectoryListing(fileSystem fs.FS, template *template.Template) gus.Handler {
|
||||||
return func(ctx context.Context, req *gus.Request) *gus.Response {
|
return func(ctx context.Context, req *gus.Request) *gus.Response {
|
||||||
path, dirFile, resp := handleDir(req, fileSystem)
|
path, dirFile, resp := handleDir(req, fileSystem)
|
||||||
if resp != nil {
|
if dirFile == nil {
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
defer dirFile.Close()
|
defer dirFile.Close()
|
||||||
|
|
|
@ -12,8 +12,10 @@ import (
|
||||||
//
|
//
|
||||||
// Templates can be provided to override the output for different line types.
|
// Templates can be provided to override the output for different line types.
|
||||||
// The templates supported are:
|
// The templates supported are:
|
||||||
// - "header" is called before any lines and is passed the full Document.
|
// - "header" is called before any lines and is passed the full Document. It should,
|
||||||
// - "footer" is called after the lines and is passed the full Document.
|
// at a minimum, produce opening <html> and <body> tags.
|
||||||
|
// - "footer" is called after the lines and is passed the full Document. It should,
|
||||||
|
// at a minimum, provide closing </body> and </html> tags.
|
||||||
// - "textline" is called once per line of text and is passed a gemtext.TextLine.
|
// - "textline" is called once per line of text and is passed a gemtext.TextLine.
|
||||||
// - "linkline" is called once per link line and is passed an object which wraps
|
// - "linkline" is called once per link line and is passed an object which wraps
|
||||||
// a gemtext.LinkLine but also supports a ValidatedURL() method returning a
|
// a gemtext.LinkLine but also supports a ValidatedURL() method returning a
|
||||||
|
|
|
@ -29,11 +29,11 @@ func FallthroughHandler(handlers ...Handler) Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter builds a middleware which only calls the wrapped under a condition.
|
// Filter builds a middleware which only calls the wrapped Handler under a condition.
|
||||||
//
|
//
|
||||||
// When the condition function returns false it instead invokes the
|
// When the condition function returns false it instead invokes the test-failure
|
||||||
// test-failure handler. The failure handler may also be nil, in which case
|
// handler. The failure handler may also be nil, in which case the final handler will
|
||||||
// the final handler will return a nil response whenever the condition fails.
|
// return a nil response whenever the condition fails.
|
||||||
func Filter(
|
func Filter(
|
||||||
condition func(context.Context, *Request) bool,
|
condition func(context.Context, *Request) bool,
|
||||||
failure Handler,
|
failure Handler,
|
||||||
|
|
Reference in New Issue