Permalink
Browse files

Enhance Page and Resource String()

  • Loading branch information...
vassudanagunta authored and bep committed May 25, 2018
1 parent fc8c5ad commit 4f0665f476e06e9707621c18f7422fdeb776e0d1
Showing with 8 additions and 2 deletions.
  1. +4 −0 hugolib/page.go
  2. +4 −2 resource/resource.go
View
@@ -2013,7 +2013,11 @@ func (p *Page) RelRef(refs ...string) (string, error) {
}
func (p *Page) String() string {
if p.Path() != "" {
return fmt.Sprintf("Page(%s)", p.Path())
}
return fmt.Sprintf("Page(%q)", p.title)
}
// Scratch returns the writable context associated with this Page.
View
@@ -419,8 +419,6 @@ type genericResource struct {
// The relative path to this resource.
relTargetPath dirFile
file string
// Base is set when the output format's path has a offset, e.g. for AMP.
base string
@@ -554,6 +552,10 @@ func (l *genericResource) AbsSourceFilename() string {
return l.sourceFilename
}
func (l *genericResource) String() string {
return fmt.Sprintf("Resource(%s: %s)", l.resourceType, l.name)
}
func (l *genericResource) Publish() error {
f, err := l.sourceFs().Open(l.AbsSourceFilename())
if err != nil {

0 comments on commit 4f0665f

Please sign in to comment.