mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
output: Fix golint godoc issues
This commit is contained in:
parent
ffaa73dc8a
commit
3f45e729f4
2 changed files with 9 additions and 3 deletions
|
@ -30,6 +30,7 @@ var (
|
||||||
goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define"), []byte("{{- define"), []byte("{{-define")}
|
goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define"), []byte("{{- define"), []byte("{{-define")}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TemplateNames represents a template naming scheme.
|
||||||
type TemplateNames struct {
|
type TemplateNames struct {
|
||||||
// The name used as key in the template map. Note that this will be
|
// The name used as key in the template map. Note that this will be
|
||||||
// prefixed with "_text/" if it should be parsed with text/template.
|
// prefixed with "_text/" if it should be parsed with text/template.
|
||||||
|
@ -39,6 +40,7 @@ type TemplateNames struct {
|
||||||
MasterFilename string
|
MasterFilename string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TemplateLookupDescriptor describes the template lookup configuration.
|
||||||
type TemplateLookupDescriptor struct {
|
type TemplateLookupDescriptor struct {
|
||||||
// The full path to the site root.
|
// The full path to the site root.
|
||||||
WorkingDir string
|
WorkingDir string
|
||||||
|
@ -62,6 +64,7 @@ func isShorthCodeOrPartial(name string) bool {
|
||||||
return strings.HasPrefix(name, "shortcodes/") || strings.HasPrefix(name, "partials/")
|
return strings.HasPrefix(name, "shortcodes/") || strings.HasPrefix(name, "partials/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTemplateNames returns a TemplateNames object for a given template.
|
||||||
func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
|
func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
|
||||||
|
|
||||||
name := filepath.ToSlash(d.RelPath)
|
name := filepath.ToSlash(d.RelPath)
|
||||||
|
|
|
@ -71,10 +71,8 @@ type Format struct {
|
||||||
NotAlternative bool `json:"notAlternative"`
|
NotAlternative bool `json:"notAlternative"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An ordered list of built-in output formats.
|
||||||
var (
|
var (
|
||||||
// An ordered list of built-in output formats
|
|
||||||
//
|
|
||||||
// See https://www.ampproject.org/learn/overview/
|
|
||||||
AMPFormat = Format{
|
AMPFormat = Format{
|
||||||
Name: "AMP",
|
Name: "AMP",
|
||||||
MediaType: media.HTMLType,
|
MediaType: media.HTMLType,
|
||||||
|
@ -82,6 +80,7 @@ var (
|
||||||
Path: "amp",
|
Path: "amp",
|
||||||
Rel: "amphtml",
|
Rel: "amphtml",
|
||||||
IsHTML: true,
|
IsHTML: true,
|
||||||
|
// See https://www.ampproject.org/learn/overview/
|
||||||
}
|
}
|
||||||
|
|
||||||
CalendarFormat = Format{
|
CalendarFormat = Format{
|
||||||
|
@ -150,6 +149,7 @@ var (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DefaultFormats contains the default output formats supported by Hugo.
|
||||||
var DefaultFormats = Formats{
|
var DefaultFormats = Formats{
|
||||||
AMPFormat,
|
AMPFormat,
|
||||||
CalendarFormat,
|
CalendarFormat,
|
||||||
|
@ -166,6 +166,7 @@ func init() {
|
||||||
sort.Sort(DefaultFormats)
|
sort.Sort(DefaultFormats)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Formats is a slice of Format.
|
||||||
type Formats []Format
|
type Formats []Format
|
||||||
|
|
||||||
func (formats Formats) Len() int { return len(formats) }
|
func (formats Formats) Len() int { return len(formats) }
|
||||||
|
@ -330,10 +331,12 @@ func decode(mediaTypes media.Types, input, output interface{}) error {
|
||||||
return decoder.Decode(input)
|
return decoder.Decode(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BaseFilename returns the base filename of formats.
|
||||||
func (formats Format) BaseFilename() string {
|
func (formats Format) BaseFilename() string {
|
||||||
return formats.BaseName + formats.MediaType.FullSuffix()
|
return formats.BaseName + formats.MediaType.FullSuffix()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON returns the JSON encoding of formats.
|
||||||
func (formats Format) MarshalJSON() ([]byte, error) {
|
func (formats Format) MarshalJSON() ([]byte, error) {
|
||||||
type Alias Format
|
type Alias Format
|
||||||
return json.Marshal(&struct {
|
return json.Marshal(&struct {
|
||||||
|
|
Loading…
Reference in a new issue