Enhance Page and Resource String() - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 4f0665f476e06e9707621c18f7422fdeb776e0d1
DIR parent fc8c5ad824160cbf0868a8fb54c24a382626c73c
HTML Author: Vas Sudanagunta <vas@commonkarma.org>
Date: Fri, 25 May 2018 19:59:58 -0400
Enhance Page and Resource String()
Diffstat:
M hugolib/page.go | 4 ++++
M resource/resource.go | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
DIR diff --git a/hugolib/page.go b/hugolib/page.go
@@ -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.
DIR diff --git a/resource/resource.go b/resource/resource.go
@@ -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 {