mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Hyperlinks affect backlink calculation issue https://github.com/siyuan-note/siyuan/issues/11001
This commit is contained in:
parent
ee473289d2
commit
3a852fd1ab
2 changed files with 6 additions and 5 deletions
|
|
@ -521,12 +521,13 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keyword string) (ret []*Bl
|
||||||
for parentID, _ := range parentRefParagraphs {
|
for parentID, _ := range parentRefParagraphs {
|
||||||
paragraphParentIDs = append(paragraphParentIDs, parentID)
|
paragraphParentIDs = append(paragraphParentIDs, parentID)
|
||||||
}
|
}
|
||||||
paragraphParents := sql.GetBlocks(paragraphParentIDs)
|
sqlParagraphParents := sql.GetBlocks(paragraphParentIDs)
|
||||||
|
paragraphParents := fromSQLBlocks(&sqlParagraphParents, "", 12)
|
||||||
|
|
||||||
processedParagraphs := hashset.New()
|
processedParagraphs := hashset.New()
|
||||||
for _, p := range paragraphParents {
|
for _, p := range paragraphParents {
|
||||||
// 改进标题下方块和列表项子块引用时的反链定位 https://github.com/siyuan-note/siyuan/issues/7484
|
// 改进标题下方块和列表项子块引用时的反链定位 https://github.com/siyuan-note/siyuan/issues/7484
|
||||||
if "i" == p.Type {
|
if "NodeListItem" == p.Type {
|
||||||
refBlock := parentRefParagraphs[p.ID]
|
refBlock := parentRefParagraphs[p.ID]
|
||||||
if nil != refBlock && p.FContent == refBlock.Content { // 使用内容判断是否是列表项下第一个子块
|
if nil != refBlock && p.FContent == refBlock.Content { // 使用内容判断是否是列表项下第一个子块
|
||||||
// 如果是列表项下第一个子块,则后续会通过列表项传递或关联处理,所以这里就不处理这个段落了
|
// 如果是列表项下第一个子块,则后续会通过列表项传递或关联处理,所以这里就不处理这个段落了
|
||||||
|
|
@ -535,7 +536,7 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keyword string) (ret []*Bl
|
||||||
refsCount--
|
refsCount--
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ret = append(ret, fromSQLBlock(p, "", 12))
|
ret = append(ret, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1339,7 +1339,7 @@ func fromSQLBlock(sqlBlock *sql.Block, terms string, beforeLen int) (block *Bloc
|
||||||
content, _ = markSearch(content, terms, beforeLen)
|
content, _ = markSearch(content, terms, beforeLen)
|
||||||
content = maxContent(content, 5120)
|
content = maxContent(content, 5120)
|
||||||
markdown := maxContent(sqlBlock.Markdown, 5120)
|
markdown := maxContent(sqlBlock.Markdown, 5120)
|
||||||
|
fContent := util.EscapeHTML(sqlBlock.FContent) // fContent 会用于和 content 对比,在反链计算时用于判断是否是列表项下第一个子块,所以也需要转义 https://github.com/siyuan-note/siyuan/issues/11001
|
||||||
block = &Block{
|
block = &Block{
|
||||||
Box: sqlBlock.Box,
|
Box: sqlBlock.Box,
|
||||||
Path: sqlBlock.Path,
|
Path: sqlBlock.Path,
|
||||||
|
|
@ -1351,7 +1351,7 @@ func fromSQLBlock(sqlBlock *sql.Block, terms string, beforeLen int) (block *Bloc
|
||||||
Memo: sqlBlock.Memo,
|
Memo: sqlBlock.Memo,
|
||||||
Tag: sqlBlock.Tag,
|
Tag: sqlBlock.Tag,
|
||||||
Content: content,
|
Content: content,
|
||||||
FContent: sqlBlock.FContent,
|
FContent: fContent,
|
||||||
Markdown: markdown,
|
Markdown: markdown,
|
||||||
Type: treenode.FromAbbrType(sqlBlock.Type),
|
Type: treenode.FromAbbrType(sqlBlock.Type),
|
||||||
SubType: sqlBlock.SubType,
|
SubType: sqlBlock.SubType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue