mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Misc doc, code refactoring to improve documentation
This commit is contained in:
2
common/docs.go
Normal file
2
common/docs.go
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package common provides common helper functionality for Hugo.
|
||||
package common
|
@@ -30,6 +30,7 @@ type Scratch struct {
|
||||
|
||||
// Scratcher provides a scratching service.
|
||||
type Scratcher interface {
|
||||
// Scratch returns a "scratch pad" that can be used to store state.
|
||||
Scratch() *Scratch
|
||||
}
|
||||
|
||||
|
@@ -263,3 +263,14 @@ func (n NamedSlice) String() string {
|
||||
}
|
||||
return fmt.Sprintf("%s%s{%s}", n.Name, FilePathSeparator, strings.Join(n.Slice, ","))
|
||||
}
|
||||
|
||||
// DirFile holds the result from path.Split.
|
||||
type DirFile struct {
|
||||
Dir string
|
||||
File string
|
||||
}
|
||||
|
||||
// Used in test.
|
||||
func (df DirFile) String() string {
|
||||
return fmt.Sprintf("%s|%s", df.Dir, df.File)
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@ import (
|
||||
// Positioner represents a thing that knows its position in a text file or stream,
|
||||
// typically an error.
|
||||
type Positioner interface {
|
||||
// Position returns the current position.
|
||||
// Useful in error logging, e.g. {{ errorf "error in code block: %s" .Position }}.
|
||||
Position() Position
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user