Simplify Static Generators Code; progresses on #108
Former-commit-id: 7f4552b70980f39204e5a5517a1c1f3602304569 [formerly 0c9cdc2a1e988d378f8a068b9a6b53eb41144f2f] [formerly e221c08add31a6837c8695c413b2c55d31806f16 [formerly 7ee721a9e348cded23d18fdbff2b53a692d7a27b]] Former-commit-id: de2ff86dbc24a8f77260539d656201daf9dfebe5 [formerly 3d0eb1e810bbce97a7bf430abf0d0c7a3833ce2a] Former-commit-id: 6f22d477a1105c7b84cbe70dda1afb0d364e47c5
This commit is contained in:
@@ -121,15 +121,6 @@ type FileManager struct {
|
||||
Commands map[string][]string
|
||||
}
|
||||
|
||||
type StaticGen interface {
|
||||
SettingsPath() string
|
||||
|
||||
Hook(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error)
|
||||
Preview(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error)
|
||||
Publish(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error)
|
||||
Schedule(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error)
|
||||
}
|
||||
|
||||
// Command is a command function.
|
||||
type Command func(r *http.Request, m *FileManager, u *User) error
|
||||
|
||||
@@ -357,6 +348,8 @@ func (m *FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// EnableStaticGen attaches a static generator to the current File Manager
|
||||
// instance.
|
||||
func (m *FileManager) EnableStaticGen(data StaticGen) error {
|
||||
if reflect.TypeOf(data).Kind() != reflect.Ptr {
|
||||
return errors.New("data should be a pointer to interface, not interface")
|
||||
|
||||
Reference in New Issue
Block a user