Start integrating Hugo in the new plugin

Former-commit-id: dcc6bd82b3d3a89637a1032aad1a25d0b1f80046 [formerly 8784cd37bf58e81cdbe1bcec00e6f16b58efc915] [formerly 9e25850e063ae0825de337d5d5f29cee601b9040 [formerly 8b1d36dfb9ebfa001ddeef98034bb5a73d135c94]]
Former-commit-id: 04a38bea2d141093570d9289d0d0a056a136fe8a [formerly 5995538504889e698aa6cd35b7da40c38b5d5ddf]
Former-commit-id: 8c81a0b060167e1a2983a99bc87b380838ac07dc
This commit is contained in:
Henrique Dias
2017-07-11 16:58:18 +01:00
parent 73eb1950a0
commit 749d3ea3fc
26 changed files with 837 additions and 180 deletions

12
file.go
View File

@@ -108,10 +108,10 @@ func getInfo(url *url.URL, c *FileManager, u *User) (*file, error) {
}
// getListing gets the information about a specific directory and its files.
func (i *file) getListing(c *requestContext, r *http.Request) error {
func (i *file) getListing(c *RequestContext, r *http.Request) error {
// Gets the directory information using the Virtual File System of
// the user configuration.
f, err := c.us.FileSystem.OpenFile(context.TODO(), c.fi.VirtualPath, os.O_RDONLY, 0)
f, err := c.User.FileSystem.OpenFile(context.TODO(), c.FI.VirtualPath, os.O_RDONLY, 0)
if err != nil {
return err
}
@@ -130,7 +130,7 @@ func (i *file) getListing(c *requestContext, r *http.Request) error {
for _, f := range files {
name := f.Name()
allowed := c.us.Allowed("/" + name)
allowed := c.User.Allowed("/" + name)
if !allowed {
continue
@@ -433,12 +433,14 @@ func editorLanguage(mode string) string {
mode = "asciidoc"
case "rst":
mode = "rst"
case "html", "htm":
mode = "html"
case "html", "htm", "xml":
mode = "htmlmixed"
case "js":
mode = "javascript"
case "go":
mode = "golang"
case "":
mode = "text"
}
return mode