🎨 Add ial for building embed block

This commit is contained in:
Daniel 2023-11-24 12:44:51 +08:00
parent 59dcc2637a
commit 80b68e6eb9
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/88250/lute/ast"
@ -647,6 +648,16 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
content := renderBlockContentByNodes(nodes)
block = &Block{Box: def.Box, Path: def.Path, HPath: b.HPath, ID: def.ID, Type: def.Type.String(), Content: dom, Markdown: content /* 这里使用 Markdown 字段来临时存储 content */}
if "" != sqlBlock.IAL {
block.IAL = map[string]string{}
ialStr := strings.TrimPrefix(sqlBlock.IAL, "{:")
ialStr = strings.TrimSuffix(ialStr, "}")
ial := parse.Tokens2IAL([]byte(ialStr))
for _, kv := range ial {
block.IAL[kv[0]] = kv[1]
}
}
if breadcrumb {
blockPaths = buildBlockBreadcrumb(def, nil)
}