shithub: hugo

Download patch

ref: 55dd533bf759ab1e19fd5ff3d38f7fa5f3fd589a
parent: b82cd82f1198a371ed94bda7faafe22813f4cb29
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Jun 8 18:32:01 EDT 2017

hugolib: Unexport some internal methods

--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -313,7 +313,7 @@
 	return fmt.Sprintf("Pages(%d)", len(ps))
 }
 
-func (ps Pages) FindPagePosByFilePath(inPath string) int {
+func (ps Pages) findPagePosByFilePath(inPath string) int {
 	for i, x := range ps {
 		if x.Source.Path() == inPath {
 			return i
@@ -322,7 +322,7 @@
 	return -1
 }
 
-func (ps Pages) FindPagePosByFilePathPrefix(prefix string) int {
+func (ps Pages) findFirstPagePosByFilePathPrefix(prefix string) int {
 	if prefix == "" {
 		return -1
 	}
@@ -334,9 +334,9 @@
 	return -1
 }
 
-// FindPagePos Given a page, it will find the position in Pages
+// findPagePos Given a page, it will find the position in Pages
 // will return -1 if not found
-func (ps Pages) FindPagePos(page *Page) int {
+func (ps Pages) findPagePos(page *Page) int {
 	for i, x := range ps {
 		if x.Source.Path() == page.Source.Path() {
 			return i
--- a/hugolib/page_collections.go
+++ b/hugolib/page_collections.go
@@ -141,7 +141,7 @@
 // so we need to remove all below a given path.
 func (c *PageCollections) removePageByPathPrefix(path string) {
 	for {
-		i := c.rawAllPages.FindPagePosByFilePathPrefix(path)
+		i := c.rawAllPages.findFirstPagePosByFilePathPrefix(path)
 		if i == -1 {
 			break
 		}
@@ -150,13 +150,13 @@
 }
 
 func (c *PageCollections) removePageByPath(path string) {
-	if i := c.rawAllPages.FindPagePosByFilePath(path); i >= 0 {
+	if i := c.rawAllPages.findPagePosByFilePath(path); i >= 0 {
 		c.rawAllPages = append(c.rawAllPages[:i], c.rawAllPages[i+1:]...)
 	}
 }
 
 func (c *PageCollections) removePage(page *Page) {
-	if i := c.rawAllPages.FindPagePos(page); i >= 0 {
+	if i := c.rawAllPages.findPagePos(page); i >= 0 {
 		c.rawAllPages = append(c.rawAllPages[:i], c.rawAllPages[i+1:]...)
 	}
 }