♻️ Extract method util.GetTreeID

This commit is contained in:
Daniel 2024-11-29 08:41:43 +08:00
parent c295a496d7
commit 6f7e106be4
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
11 changed files with 26 additions and 27 deletions

View file

@ -20,7 +20,6 @@ import (
"crypto/sha256"
"fmt"
"io/fs"
"path"
"path/filepath"
"sort"
"strings"
@ -61,7 +60,7 @@ func TreeRoot(node *ast.Node) *ast.Node {
}
func NewTree(boxID, p, hp, title string) *parse.Tree {
id := strings.TrimSuffix(path.Base(p), ".sy")
id := util.GetTreeID(p)
root := &ast.Node{Type: ast.NodeDocument, ID: id, Spec: "1", Box: boxID, Path: p}
root.SetIALAttr("title", title)
root.SetIALAttr("id", id)