Skip to content

Commit

Permalink
output: Fix golint godoc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
moorereason authored and bep committed Sep 7, 2018
1 parent ffaa73d commit 3f45e72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions output/layout_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define"), []byte("{{- define"), []byte("{{-define")}
)

// TemplateNames represents a template naming scheme.
type TemplateNames struct {
// 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.
Expand All @@ -39,6 +40,7 @@ type TemplateNames struct {
MasterFilename string
}

// TemplateLookupDescriptor describes the template lookup configuration.
type TemplateLookupDescriptor struct {
// The full path to the site root.
WorkingDir string
Expand All @@ -62,6 +64,7 @@ func isShorthCodeOrPartial(name string) bool {
return strings.HasPrefix(name, "shortcodes/") || strings.HasPrefix(name, "partials/")
}

// CreateTemplateNames returns a TemplateNames object for a given template.
func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {

name := filepath.ToSlash(d.RelPath)
Expand Down
9 changes: 6 additions & 3 deletions output/outputFormat.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,16 @@ type Format struct {
NotAlternative bool `json:"notAlternative"`
}

// An ordered list of built-in output formats.
var (
// An ordered list of built-in output formats
//
// See https://www.ampproject.org/learn/overview/
AMPFormat = Format{
Name: "AMP",
MediaType: media.HTMLType,
BaseName: "index",
Path: "amp",
Rel: "amphtml",
IsHTML: true,
// See https://www.ampproject.org/learn/overview/
}

CalendarFormat = Format{
Expand Down Expand Up @@ -150,6 +149,7 @@ var (
}
)

// DefaultFormats contains the default output formats supported by Hugo.
var DefaultFormats = Formats{
AMPFormat,
CalendarFormat,
Expand All @@ -166,6 +166,7 @@ func init() {
sort.Sort(DefaultFormats)
}

// Formats is a slice of Format.
type Formats []Format

func (formats Formats) Len() int { return len(formats) }
Expand Down Expand Up @@ -330,10 +331,12 @@ func decode(mediaTypes media.Types, input, output interface{}) error {
return decoder.Decode(input)
}

// BaseFilename returns the base filename of formats.
func (formats Format) BaseFilename() string {
return formats.BaseName + formats.MediaType.FullSuffix()
}

// MarshalJSON returns the JSON encoding of formats.
func (formats Format) MarshalJSON() ([]byte, error) {
type Alias Format
return json.Marshal(&struct {
Expand Down

0 comments on commit 3f45e72

Please sign in to comment.