Documentation
¶
Index ¶
- func AppendFrontMatterRune(frontmatter []byte, language string) []byte
- func CanBeEdited(filename string) bool
- func HasFrontMatterRune(file []byte) bool
- func ParseCompleteFile(data map[string]interface{}, filename string, frontmatter string) ([]byte, int, error)
- func ParseFrontMatter(data interface{}, frontmatter string) ([]byte, int, error)
- func ParseFrontMatterOnlyFile(data interface{}, filename string) ([]byte, int, error)
- func SimplifyMimeType(name string) string
- type Editor
- type Info
- func (i *Info) Delete() (int, error)
- func (i *Info) GetEditor() (*Editor, error)
- func (i *Info) GetExtendedInfo() error
- func (i Info) HumanModTime(format string) string
- func (i Info) HumanSize() string
- func (i *Info) Read() error
- func (i *Info) Rename(w http.ResponseWriter, r *http.Request) (int, error)
- func (i *Info) ServeAsHTML(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
- func (i *Info) ServeRawFile(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
- func (i *Info) Update(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
- type Listing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFrontMatterRune ¶
AppendFrontMatterRune appends the frontmatter rune to a file
func CanBeEdited ¶
CanBeEdited checks if the extension of a file is supported by the editor
func HasFrontMatterRune ¶
HasFrontMatterRune checks if the file has the frontmatter rune
func ParseCompleteFile ¶
func ParseCompleteFile(data map[string]interface{}, filename string, frontmatter string) ([]byte, int, error)
ParseCompleteFile parses a complete file
func ParseFrontMatter ¶
ParseFrontMatter is the frontmatter parser
func ParseFrontMatterOnlyFile ¶
ParseFrontMatterOnlyFile parses a frontmatter only file
func SimplifyMimeType ¶
SimplifyMimeType returns the base type of a file
Types ¶
type Editor ¶
type Editor struct { Class string Mode string Content string FrontMatter *frontmatter.Content }
Editor contains the information for the editor page
type Info ¶
type Info struct { IsDir bool Name string Size int64 URL string Path string // The relative Path of the file/directory relative to Caddyfile. RootPath string // The Path of the file/directory on http.FileSystem. ModTime time.Time Mode os.FileMode Mimetype string Content string Raw []byte Type string }
Info is the information about a particular file or directory
func GetInfo ¶
GetInfo gets the file information and, in case of error, returns the respective HTTP error code
func (*Info) GetExtendedInfo ¶
GetExtendedInfo is used to get extra parameters for FileInfo struct
func (Info) HumanModTime ¶
HumanModTime returns the modified time of the file as a human-readable string.
func (Info) HumanSize ¶
HumanSize returns the size of the file as a human-readable string in IEC format (i.e. power of 2 or base 1024).
func (*Info) ServeAsHTML ¶
ServeAsHTML is used to serve single file pages
func (*Info) ServeRawFile ¶
ServeRawFile serves raw files
type Listing ¶
type Listing struct { // The name of the directory (the last element of the path) Name string // The full path of the request Path string // The items (files and folders) in the path Items []Info // The number of directories in the listing NumDirs int // The number of files (items that aren't directories) in the listing NumFiles int // Which sorting order is used Sort string // And which order Order string // If ≠0 then Items have been limited to that many elements ItemsLimitedTo int httpserver.Context `json:"-"` }
A Listing is the context used to fill out a template.