Christian Oliff
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with
15 additions and
15 deletions
-
output/outputFormat.go
-
resources/internal/resourcepaths.go
-
resources/page/permalinks.go
-
resources/page/site.go
-
resources/resource.go
-
resources/resource_spec.go
-
tpl/collections/collections.go
-
tpl/fmt/fmt.go
-
tpl/internal/resourcehelpers/helpers.go
-
watcher/filenotify/poller.go
-
watchtestscripts.sh
|
|
@ -72,10 +72,10 @@ type Format struct { |
|
|
|
// Setting this will make this output format control the value of
|
|
|
|
// .Permalink and .RelPermalink for a rendered Page.
|
|
|
|
// If not set, these values will point to the main (first) output format
|
|
|
|
// configured. That is probably the behaviour you want in most situations,
|
|
|
|
// configured. That is probably the behavior you want in most situations,
|
|
|
|
// as you probably don't want to link back to the RSS version of a page, as an
|
|
|
|
// example. AMP would, however, be a good example of an output format where this
|
|
|
|
// behaviour is wanted.
|
|
|
|
// behavior is wanted.
|
|
|
|
Permalinkable bool `json:"permalinkable"` |
|
|
|
|
|
|
|
// Setting this to a non-zero value will be used as the first sort criteria.
|
|
|
|
|
|
@ -21,7 +21,7 @@ import ( |
|
|
|
"github.com/gohugoio/hugo/common/paths" |
|
|
|
) |
|
|
|
|
|
|
|
// ResourcePaths holds path information for a resouce.
|
|
|
|
// ResourcePaths holds path information for a resource.
|
|
|
|
// All directories in here have Unix-style slashes, with leading slash, but no trailing slash.
|
|
|
|
// Empty directories are represented with an empty string.
|
|
|
|
type ResourcePaths struct { |
|
|
|
|
|
@ -30,7 +30,7 @@ import ( |
|
|
|
"github.com/gohugoio/hugo/resources/kinds" |
|
|
|
) |
|
|
|
|
|
|
|
// PermalinkExpander holds permalin mappings per section.
|
|
|
|
// PermalinkExpander holds permalink mappings per section.
|
|
|
|
type PermalinkExpander struct { |
|
|
|
// knownPermalinkAttributes maps :tags in a permalink specification to a
|
|
|
|
// function which, given a page and the tag, returns the resulting string
|
|
|
@ -422,7 +422,7 @@ func DecodePermalinksConfig(m map[string]any) (map[string]map[string]string, err |
|
|
|
// [permalinks]
|
|
|
|
// key = '...'
|
|
|
|
|
|
|
|
// To sucessfully be backward compatible, "default" patterns need to be set for both page and term
|
|
|
|
// To successfully be backward compatible, "default" patterns need to be set for both page and term
|
|
|
|
permalinksConfig[kinds.KindPage][k] = v |
|
|
|
permalinksConfig[kinds.KindTerm][k] = v |
|
|
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ import ( |
|
|
|
"github.com/gohugoio/hugo/navigation" |
|
|
|
) |
|
|
|
|
|
|
|
// Site represents a site. There can be multople sites in a multilingual setup.
|
|
|
|
// Site represents a site. There can be multiple sites in a multilingual setup.
|
|
|
|
type Site interface { |
|
|
|
// Returns the Language configured for this Site.
|
|
|
|
Language() *langs.Language |
|
|
|
|
|
@ -85,7 +85,7 @@ type ResourceSourceDescriptor struct { |
|
|
|
// Set when its known up front, else it's resolved from the target filename.
|
|
|
|
MediaType media.Type |
|
|
|
|
|
|
|
// Used to track depenencies (e.g. imports). May be nil if that's of no concern.
|
|
|
|
// Used to track dependencies (e.g. imports). May be nil if that's of no concern.
|
|
|
|
DependencyManager identity.Manager |
|
|
|
|
|
|
|
// A shared identity for this resource and all its clones.
|
|
|
|
|
|
@ -126,7 +126,7 @@ type Spec struct { |
|
|
|
*SpecCommon |
|
|
|
} |
|
|
|
|
|
|
|
// The parts of Spec that's comoon for all sites.
|
|
|
|
// The parts of Spec that's common for all sites.
|
|
|
|
type SpecCommon struct { |
|
|
|
incr identity.Incrementer |
|
|
|
ResourceCache *ResourceCache |
|
|
|
|
|
@ -572,7 +572,7 @@ func (ns *Namespace) Seq(args ...any) ([]int, error) { |
|
|
|
return seq, nil |
|
|
|
} |
|
|
|
|
|
|
|
// Shuffle returns list l in a randomised order.
|
|
|
|
// Shuffle returns list l in a randomized order.
|
|
|
|
func (ns *Namespace) Shuffle(l any) (any, error) { |
|
|
|
if l == nil { |
|
|
|
return nil, errors.New("both count and seq must be provided") |
|
|
|
|
|
@ -47,7 +47,7 @@ func (ns *Namespace) Print(args ...any) string { |
|
|
|
return _fmt.Sprint(args...) |
|
|
|
} |
|
|
|
|
|
|
|
// Printf returns string representation of args formatted with the layouut in format.
|
|
|
|
// Printf returns string representation of args formatted with the layout in format.
|
|
|
|
func (ns *Namespace) Printf(format string, args ...any) string { |
|
|
|
return _fmt.Sprintf(format, args...) |
|
|
|
} |
|
|
@ -87,12 +87,12 @@ func (ns *Namespace) Warnidf(id, format string, args ...any) string { |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// Warnmf is epxermimental and subject to change at any time.
|
|
|
|
// Warnmf is experimental and subject to change at any time.
|
|
|
|
func (ns *Namespace) Warnmf(m any, format string, args ...any) string { |
|
|
|
return ns.logmf(ns.logger.Warn(), m, format, args...) |
|
|
|
} |
|
|
|
|
|
|
|
// Errormf is epxermimental and subject to change at any time.
|
|
|
|
// Errormf is experimental and subject to change at any time.
|
|
|
|
func (ns *Namespace) Errormf(m any, format string, args ...any) string { |
|
|
|
return ns.logmf(ns.logger.Error(), m, format, args...) |
|
|
|
} |
|
|
|
|
|
@ -38,7 +38,7 @@ func ResolveIfFirstArgIsString(args []any) (resources.ResourceTransformer, strin |
|
|
|
return v2, v1, ok2 |
|
|
|
} |
|
|
|
|
|
|
|
// This roundabout way of doing it is needed to get both pipeline behaviour and options as arguments.
|
|
|
|
// This roundabout way of doing it is needed to get both pipeline behavior and options as arguments.
|
|
|
|
func ResolveArgs(args []any) (resources.ResourceTransformer, map[string]any, error) { |
|
|
|
if len(args) == 0 { |
|
|
|
return nil, nil, errors.New("no Resource provided in transformation") |
|
|
|
|
|
@ -201,7 +201,7 @@ func (r *recording) record(filename string) error { |
|
|
|
r.FileInfo = fi |
|
|
|
|
|
|
|
// If fi is a dir, we watch the files inside that directory (not recursively).
|
|
|
|
// This matches the behaviour of fsnotity.
|
|
|
|
// This matches the behavior of fsnotity.
|
|
|
|
if fi.IsDir() { |
|
|
|
f, err := os.Open(filename) |
|
|
|
if err != nil { |
|
|
|
|
|
@ -3,5 +3,5 @@ |
|
|
|
trap exit SIGINT |
|
|
|
|
|
|
|
# I use "run tests on save" in my editor. |
|
|
|
# Unfortantly, changes to text files does not trigger this. Hence this workaround. |
|
|
|
# Unfortunately, changes to text files does not trigger this. Hence this workaround. |
|
|
|
while true; do find testscripts -type f -name "*.txt" | entr -pd touch main_test.go; done |