diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index 7f3163b4aab..c3e91703dc5 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -304,6 +304,8 @@ func buildBlockBreadcrumb(node *ast.Node, excludeTypes []string) (ret []*BlockPa name := util.EscapeHTML(parent.IALAttr("name")) if ast.NodeDocument == parent.Type { name = util.EscapeHTML(box.Name) + util.EscapeHTML(hPath) + } else if ast.NodeAttributeView == parent.Type { + name = treenode.GetAttributeViewName(parent.AttributeViewID) } else { if "" == name { if ast.NodeListItem == parent.Type { diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 3110a765756..0b7f3e3dab4 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -475,6 +475,27 @@ func IsChartCodeBlockCode(code *ast.Node) bool { return render.NoHighlight(language) } +func GetAttributeViewName(avID string) (name string) { + if "" == avID { + return + } + + attrView, err := av.ParseAttributeView(avID) + if nil != err { + logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err) + return + } + + buf := bytes.Buffer{} + for _, v := range attrView.Views { + buf.WriteString(v.Name) + buf.WriteByte(' ') + } + + name = strings.TrimSpace(buf.String()) + return +} + func getAttributeViewContent(avID string) (content string) { if "" == avID { return