From daf964d8d3d9b3f89f886f9c7a5a432d24f8b6a4 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 9 Oct 2024 11:11:47 +0800 Subject: [PATCH 1/2] :art: Improve ref count rendering https://github.com/siyuan-note/siyuan/issues/12738 --- kernel/model/block.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/kernel/model/block.go b/kernel/model/block.go index c45595a67..958cdf479 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -24,6 +24,7 @@ import ( "strings" "time" + "github.com/88250/gulu" "github.com/88250/lute/ast" "github.com/88250/lute/parse" "github.com/open-spaced-repetition/go-fsrs/v3" @@ -859,13 +860,30 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading // 嵌入块查询结果中显示块引用计数 https://github.com/siyuan-note/siyuan/issues/7191 var defIDs []string for _, n := range nodes { - defIDs = append(defIDs, n.ID) + ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering { + return ast.WalkContinue + } + + if n.IsBlock() { + defIDs = append(defIDs, n.ID) + } + return ast.WalkContinue + }) } + defIDs = gulu.Str.RemoveDuplicatedElem(defIDs) refCount := sql.QueryRefCount(defIDs) for _, n := range nodes { - if cnt := refCount[n.ID]; 0 < cnt { - n.SetIALAttr("refcount", strconv.Itoa(cnt)) - } + ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering || !n.IsBlock() { + return ast.WalkContinue + } + + if cnt := refCount[n.ID]; 0 < cnt { + n.SetIALAttr("refcount", strconv.Itoa(cnt)) + } + return ast.WalkContinue + }) } luteEngine := NewLute() From 2a74c3e556b5c08baf391a63099e85c6f9700960 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:18:06 +0800 Subject: [PATCH 2/2] :art: Improve user guide daily notes chapter https://ld246.com/article/1728386759300 (#12737) --- .../20201204184532-3qm9l8n.sy | 8 ++--- .../20210110181011-fbhoesf.sy | 30 +++++++++++++------ .../20201204181006-7bkppue.sy | 8 ++--- .../20210110175347-2xrwoiq.sy | 20 +++++++++---- .../20211226123004-dplpw0o.sy | 8 ++--- .../20211226123154-fd5e001.sy | 20 +++++++++---- .../20240530101000-scr2p21.sy | 10 +++---- 7 files changed, 67 insertions(+), 37 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy index f0f8682ec..cc9e1d5ba 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201204184532-3qm9l8n.sy @@ -6,7 +6,7 @@ "id": "20201204184532-3qm9l8n", "title": "Template snippet", "type": "doc", - "updated": "20240921122726" + "updated": "20241008202623" }, "Children": [ { @@ -57,7 +57,7 @@ "HeadingLevel": 2, "Properties": { "id": "20210104091444-jy56z0p", - "updated": "20240921122726" + "updated": "20241008202623" }, "Children": [ { @@ -117,12 +117,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20210104091444-c7gg3ak", - "updated": "20230820185644" + "updated": "20241008202623" }, "Children": [ { "Type": "NodeText", - "Data": "We have built-in variables and functions to enrich the template through the open source project Sprig (github repo: Masterminds/sprig). For example, you can use " + "Data": "We have built-in variables and functions to enrich the template through the open source project Sprig (GitHub repo: Masterminds/sprig). For example, you can use " }, { "Type": "NodeTextMark", diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210110181011-fbhoesf.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210110181011-fbhoesf.sy index 3f076c6d0..ce83e4255 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210110181011-fbhoesf.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20210110181011-fbhoesf.sy @@ -6,7 +6,7 @@ "id": "20210110181011-fbhoesf", "title": "Daily notes", "type": "doc", - "updated": "20210110181011" + "updated": "20241008202033" }, "Children": [ { @@ -14,12 +14,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20210110181041-j47iwxx", - "updated": "20210302223722" + "updated": "20241008201757" }, "Children": [ { "Type": "NodeText", - "Data": "We can quickly create a document through the daily note. The entry of the daily note function in the top toolbar looks like a calendar button." + "Data": "We can quickly create a document through the daily note, and the daily note function entrance is in the top main menu." } ] }, @@ -28,12 +28,21 @@ "Type": "NodeParagraph", "Properties": { "id": "20210110181041-dnap16f", - "updated": "20210303230545" + "updated": "20241008202033" }, "Children": [ { "Type": "NodeText", - "Data": "But before using the daily note, you need to select settings in the right-click drop-down menu of the notebook, and configure in the new diary settings:" + "Data": "Before using the daily note, you need to open " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "Settings" + }, + { + "Type": "NodeText", + "Data": "​ in the notebook right-click menu, and configure in the new diary settings:" } ] }, @@ -48,7 +57,8 @@ "Num": -1 }, "Properties": { - "id": "20210110181041-24ejxr4" + "id": "20210110181041-24ejxr4", + "updated": "20241008202018" }, "Children": [ { @@ -63,19 +73,21 @@ "Num": -1 }, "Properties": { - "id": "20210110181041-3dq1cg4" + "id": "20210110181041-3dq1cg4", + "updated": "20241008202018" }, "Children": [ { "ID": "20210302223720-m8ekt02", "Type": "NodeParagraph", "Properties": { - "id": "20210302223720-m8ekt02" + "id": "20210302223720-m8ekt02", + "updated": "20241008202018" }, "Children": [ { "Type": "NodeText", - "Data": "Storage path: the path under the notebook, support " + "Data": "Save path: the path under the notebook, support " }, { "Type": "NodeTextMark", diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy index 6afa7e821..10c0dc211 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201204181006-7bkppue.sy @@ -6,7 +6,7 @@ "id": "20201204181006-7bkppue", "title": "模板片段", "type": "doc", - "updated": "20240921122737" + "updated": "20241008201610" }, "Children": [ { @@ -69,7 +69,7 @@ "HeadingLevel": 2, "Properties": { "id": "20210104091309-fhb549c", - "updated": "20240921122737" + "updated": "20241008201610" }, "Children": [ { @@ -129,12 +129,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20210104091309-mvyh081", - "updated": "20240308161634" + "updated": "20241008201610" }, "Children": [ { "Type": "NodeText", - "Data": "我们通过开源项目 Sprig (github repo: Masterminds/sprig) 内置了一些变量和函数来丰富模板。比如可通过 " + "Data": "我们通过开源项目 Sprig (GitHub repo: Masterminds/sprig) 内置了一些变量和函数来丰富模板。比如可通过 " }, { "Type": "NodeTextMark", diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210110175347-2xrwoiq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210110175347-2xrwoiq.sy index 6a07a26e3..7c9853806 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210110175347-2xrwoiq.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20210110175347-2xrwoiq.sy @@ -6,19 +6,20 @@ "id": "20210110175347-2xrwoiq", "title": "日记", "type": "doc", - "updated": "20210110175347" + "updated": "20241008201419" }, "Children": [ { "ID": "20210110175347-jvtq2ap", "Type": "NodeParagraph", "Properties": { - "id": "20210110175347-jvtq2ap" + "id": "20210110175347-jvtq2ap", + "updated": "20241008201121" }, "Children": [ { "Type": "NodeText", - "Data": "我们可以通过日记来快速创建文档,日记功能入口在顶部工具栏形似日历的按钮。" + "Data": "我们可以通过日记来快速创建文档,日记功能入口在顶部主菜单中。" } ] }, @@ -27,12 +28,21 @@ "Type": "NodeParagraph", "Properties": { "id": "20210110175631-umo8b4h", - "updated": "20210303230529" + "updated": "20241008201419" }, "Children": [ { "Type": "NodeText", - "Data": "但在使用日记前,需要在笔记本右键下拉菜单中选择设置,在新建日记设置中配置:" + "Data": "使用日记前,需要在笔记本右键菜单中打开 " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "设置" + }, + { + "Type": "NodeText", + "Data": "​ ,在新建日记设置中配置:" } ] }, diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy index 7ebe60673..cdc402556 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123004-dplpw0o.sy @@ -6,7 +6,7 @@ "id": "20211226123004-dplpw0o", "title": "範本片段", "type": "doc", - "updated": "20240921122732" + "updated": "20241008201617" }, "Children": [ { @@ -53,7 +53,7 @@ "HeadingLevel": 2, "Properties": { "id": "20211226123024-eyagqur", - "updated": "20240921122732" + "updated": "20241008201617" }, "Children": [ { @@ -109,12 +109,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226123024-eurqp4g", - "updated": "20230820185634" + "updated": "20241008201617" }, "Children": [ { "Type": "NodeText", - "Data": "我們通過開原專案 Sprig (github repo: Masterminds/sprig) 內置了一些變量和函數來豐富範本。比如可通過 " + "Data": "我們通過開原專案 Sprig (GitHub repo: Masterminds/sprig) 內置了一些變量和函數來豐富範本。比如可通過 " }, { "Type": "NodeTextMark", diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123154-fd5e001.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123154-fd5e001.sy index 80dd01f43..cef491654 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123154-fd5e001.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226123154-fd5e001.sy @@ -5,7 +5,8 @@ "Properties": { "id": "20211226123154-fd5e001", "title": "日記", - "updated": "20230630130311" + "type": "doc", + "updated": "20241008201536" }, "Children": [ { @@ -13,12 +14,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226123205-0lxrjll", - "updated": "20230630130311" + "updated": "20241008201536" }, "Children": [ { "Type": "NodeText", - "Data": "我們可以通過日記來快速建立文檔,日記功能入口在頂部工具欄形似日曆的按鈕。" + "Data": "我們可以通過日記來快速建立文檔,日記功能入口在頂部主菜單中。" } ] }, @@ -27,12 +28,21 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226123205-aik13in", - "updated": "20211226014151" + "updated": "20241008201420" }, "Children": [ { "Type": "NodeText", - "Data": "但在使用日記前,需要在筆記本右鍵下拉菜單中選擇設置,在新建日記設置中配置:" + "Data": "使用日記前,需要在筆記本右鍵菜單中開啟 " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "kbd", + "TextMarkTextContent": "設置" + }, + { + "Type": "NodeText", + "Data": "​ ,在新建日記設置中配置:" } ] }, diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-scr2p21.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-scr2p21.sy index f4b229319..23c1363b0 100644 --- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-scr2p21.sy +++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-scr2p21.sy @@ -7,21 +7,20 @@ "id": "20240530101000-scr2p21", "title": "デイリーノート", "type": "doc", - "updated": "20240530101000" + "updated": "20241008202730" }, "Children": [ { "ID": "20240530101000-bzkce2v", "Type": "NodeParagraph", "Properties": { - "ID": "20240530101000-6y7pqdq", "id": "20240530101000-bzkce2v", - "updated": "20240530101000" + "updated": "20241008202730" }, "Children": [ { "Type": "NodeText", - "Data": "メインメニューからデイリーノートを作成できます。" + "Data": "デイリーノートを通じて素早く文書を作成できる、デイリーノート機能への入り口は上部のメインメニュにあります。" } ] }, @@ -29,9 +28,8 @@ "ID": "20240530101000-efq2rys", "Type": "NodeParagraph", "Properties": { - "ID": "20240530101000-xwijoqj", "id": "20240530101000-efq2rys", - "updated": "20240530101000" + "updated": "20241008202721" }, "Children": [ {