From c265c102ae0705011bca6999e5b1c14fb00fa859 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 16 Aug 2017 10:01:16 +0200 Subject: [PATCH] hugolib: Rename Page.Equals to Page.Eq To get the name in line with the template func `eq`. --- hugolib/site_sections.go | 4 ++-- hugolib/site_sections_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hugolib/site_sections.go b/hugolib/site_sections.go index ee982576..1ab2b0e2 100644 --- a/hugolib/site_sections.go +++ b/hugolib/site_sections.go @@ -109,10 +109,10 @@ func (p *Page) IsAncestor(other interface{}) (bool, error) { return helpers.HasStringsPrefix(pp.sections, p.sections), nil } -// Equals returns whether the current page equals the given page. +// Eq returns whether the current page equals the given page. // Note that this is more accurate than doing `{{ if eq $page $otherPage }}` // since a Page can be embedded in another type. -func (p *Page) Equals(other interface{}) (bool, error) { +func (p *Page) Eq(other interface{}) (bool, error) { pp, err := unwrapPage(other) if err != nil { return false, err diff --git a/hugolib/site_sections_test.go b/hugolib/site_sections_test.go index 95090014..355b74bb 100644 --- a/hugolib/site_sections_test.go +++ b/hugolib/site_sections_test.go @@ -150,13 +150,13 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} assert.NotNil(d) assert.Equal("T41_-1", d.Title) - equals, err := c.Equals(d) + equals, err := c.Eq(d) assert.NoError(err) assert.False(equals) - equals, err = c.Equals(c) + equals, err = c.Eq(c) assert.NoError(err) assert.True(equals) - _, err = c.Equals("asdf") + _, err = c.Eq("asdf") assert.Error(err) }}, -- 2.30.2