[add] sui page tree debug log
This commit is contained in:
parent
89fbbdf314
commit
08b7cd5aaf
1 changed files with 7 additions and 2 deletions
|
|
@ -55,7 +55,7 @@ func (tmpl *Template) PageTree(route string) ([]*core.PageTreeNode, error) {
|
||||||
tmpl.local.fs.Walk(tmpl.Root, func(root, file string, isdir bool) error {
|
tmpl.local.fs.Walk(tmpl.Root, func(root, file string, isdir bool) error {
|
||||||
name := filepath.Base(file)
|
name := filepath.Base(file)
|
||||||
relPath := file
|
relPath := file
|
||||||
log.Debug("[PageTree] file: %s isdir: %v", relPath, isdir)
|
log.Debug("[PageTree] Walk | file: %s isdir: %v name: %v", relPath, isdir, name)
|
||||||
|
|
||||||
if isdir {
|
if isdir {
|
||||||
if strings.HasPrefix(name, "__") || name == ".tmp" {
|
if strings.HasPrefix(name, "__") || name == ".tmp" {
|
||||||
|
|
@ -81,7 +81,7 @@ func (tmpl *Template) PageTree(route string) ([]*core.PageTreeNode, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug("[PageTree] dirs: %s found: %v", dir, found)
|
log.Debug("[PageTree] Walk | dirs: %s found: %v", dir, found)
|
||||||
// If not found, create a new directory node.
|
// If not found, create a new directory node.
|
||||||
if !found {
|
if !found {
|
||||||
newDir := &core.PageTreeNode{
|
newDir := &core.PageTreeNode{
|
||||||
|
|
@ -101,6 +101,7 @@ func (tmpl *Template) PageTree(route string) ([]*core.PageTreeNode, error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug("[PageTree] getPageFrom | file: %s", file)
|
||||||
page, err := tmpl.getPageFrom(file)
|
page, err := tmpl.getPageFrom(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Get page error: %v", err)
|
log.Error("Get page error: %v", err)
|
||||||
|
|
@ -109,12 +110,16 @@ func (tmpl *Template) PageTree(route string) ([]*core.PageTreeNode, error) {
|
||||||
|
|
||||||
pageInfo := page.Get()
|
pageInfo := page.Get()
|
||||||
active := route == pageInfo.Route
|
active := route == pageInfo.Route
|
||||||
|
log.Debug("[PageTree] getPageFrom |\t pageInfo.Name: %s", pageInfo.Name)
|
||||||
|
|
||||||
// Attach the page to the appropriate directory node.
|
// Attach the page to the appropriate directory node.
|
||||||
dirs := strings.Split(relPath, string(filepath.Separator))
|
dirs := strings.Split(relPath, string(filepath.Separator))
|
||||||
currentDir := rootNode
|
currentDir := rootNode
|
||||||
|
log.Debug("[PageTree] currentDir | name: %s Children: %d", currentDir.Name, len(currentDir.Children))
|
||||||
|
|
||||||
for _, dir := range dirs {
|
for _, dir := range dirs {
|
||||||
for _, child := range currentDir.Children {
|
for _, child := range currentDir.Children {
|
||||||
|
log.Debug("[PageTree] currentDir.Children | child.Name: %s dir:%s", child.Name, dir)
|
||||||
if child.Name == dir {
|
if child.Name == dir {
|
||||||
currentDir = child
|
currentDir = child
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue