mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
f10c0bcd4d
commit
98e8083122
3 changed files with 12 additions and 0 deletions
|
|
@ -93,6 +93,10 @@ func renderOutline(heading *ast.Node, luteEngine *lute.Lute) (ret string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderBlockText(node *ast.Node, excludeTypes []string) (ret string) {
|
func renderBlockText(node *ast.Node, excludeTypes []string) (ret string) {
|
||||||
|
if nil == node {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ret = sql.NodeStaticContent(node, excludeTypes, false, false, false, GetBlockAttrsWithoutWaitWriting)
|
ret = sql.NodeStaticContent(node, excludeTypes, false, false, false, GetBlockAttrsWithoutWaitWriting)
|
||||||
ret = strings.TrimSpace(ret)
|
ret = strings.TrimSpace(ret)
|
||||||
ret = strings.ReplaceAll(ret, "\n", "")
|
ret = strings.ReplaceAll(ret, "\n", "")
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,10 @@ func indexNode(tx *sql.Tx, id string) (err error) {
|
||||||
|
|
||||||
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath, fullAttrView bool,
|
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath, fullAttrView bool,
|
||||||
GetBlockAttrsWithoutWaitWriting func(id string) (ret map[string]string)) string {
|
GetBlockAttrsWithoutWaitWriting func(id string) (ret map[string]string)) string {
|
||||||
|
if nil == node {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if ast.NodeAttributeView == node.Type {
|
if ast.NodeAttributeView == node.Type {
|
||||||
if fullAttrView {
|
if fullAttrView {
|
||||||
return getAttributeViewContent(node.AttributeViewID, GetBlockAttrsWithoutWaitWriting)
|
return getAttributeViewContent(node.AttributeViewID, GetBlockAttrsWithoutWaitWriting)
|
||||||
|
|
|
||||||
|
|
@ -812,6 +812,10 @@ func GetContainerText(container *ast.Node) string {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
buf.Grow(4096)
|
buf.Grow(4096)
|
||||||
leaf := treenode.FirstLeafBlock(container)
|
leaf := treenode.FirstLeafBlock(container)
|
||||||
|
if nil == leaf {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
ast.Walk(leaf, func(n *ast.Node, entering bool) ast.WalkStatus {
|
ast.Walk(leaf, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
if !entering {
|
if !entering {
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue