1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

Handle remove & rename source operations incrementally

This commit is contained in:
Steve Francia
2016-01-11 12:06:52 -05:00
parent e01c340915
commit 7e196a8294
3 changed files with 100 additions and 70 deletions

View File

@@ -112,20 +112,20 @@ type Pages []*Page
// }
//}
//func (ps Pages) FindPageByFilePath(inPath string) *Page {
// for _, x := range ps {
// if x.Source.LogicalName() == inPath {
// return x
// }
// }
// return nil
//}
func (ps Pages) FindPagePosByFilePath(inPath string) int {
for i, x := range ps {
if x.Source.Path() == inPath {
return i
}
}
return -1
}
// FindPagePos Given a page, it will find the position in Pages
// will return -1 if not found
func (ps Pages) FindPagePos(page *Page) int {
for i, x := range ps {
if x.Source.LogicalName() == page.Source.LogicalName() {
if x.Source.Path() == page.Source.Path() {
return i
}
}