|
@@ -480,6 +480,7 @@ func BlocksWordCount(ids []string) (ret *util.BlockStatResult) {
|
|
ret.ImageCount += imgCnt
|
|
ret.ImageCount += imgCnt
|
|
ret.RefCount += refCnt
|
|
ret.RefCount += refCnt
|
|
}
|
|
}
|
|
|
|
+ ret.BlockCount = len(ids)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -491,9 +492,18 @@ func StatTree(id string) (ret *util.BlockStatResult) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ blockCount := 0
|
|
var databaseBlockNodes []*ast.Node
|
|
var databaseBlockNodes []*ast.Node
|
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
|
- if !entering || ast.NodeAttributeView != n.Type {
|
|
|
|
|
|
+ if !entering {
|
|
|
|
+ return ast.WalkContinue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if n.IsBlock() {
|
|
|
|
+ blockCount++
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ast.NodeAttributeView != n.Type {
|
|
return ast.WalkContinue
|
|
return ast.WalkContinue
|
|
}
|
|
}
|
|
|
|
|
|
@@ -585,6 +595,7 @@ func StatTree(id string) (ret *util.BlockStatResult) {
|
|
LinkCount: linkCnt,
|
|
LinkCount: linkCnt,
|
|
ImageCount: imgCnt,
|
|
ImageCount: imgCnt,
|
|
RefCount: refCnt,
|
|
RefCount: refCnt,
|
|
|
|
+ BlockCount: blockCount,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|