An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: `虚拟引用关键字排除列表` 支持正则表达式 Fix https://github.com/siyuan-note/siyuan/issues/6696
Liang Dingc04e10914b35
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 3a800d9219..0a96464569 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -612,6 +612,7 @@"md38": "The maximum length of the anchor text that is automatically rendered when the block ref anchor text is not customized, the default is <code class='fn__code'>96</code> characters","md39": "PlantUML Serve Address","md40": "Leave blank to restore default <code class='fn__code'>https://www.plantuml.com/plantuml/svg/~1</code>",+ "md41": "Support using / to wrap regular expressions, for example <code class='fn__code'>foo,/[0-9]+/</code> means to exclude foo and numbers","fileTree2": "The doc tree will automatically select the current document when the editor tab is switched","fileTree3": "No confirmation required when deleting documents","fileTree4": "If not enabled, a confirmation box will pop up every time you delete a document",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex d4410c2917..9b1ceb85cb 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -612,6 +612,7 @@"md38": "La longitud máxima del texto de anclaje que se renderiza automáticamente cuando el texto de anclaje del bloque ref no está personalizado, el valor por defecto es <code class='fn__code'>96</code> caracteres","md39": "Dirección de PlantUML Serve","md40": "Dejar en blanco para restablecer el valor por defecto <code class='fn__code'>https://www.plantuml.com/plantuml/svg/~1</code>",+ "md41": "Se admite el uso de / para ajustar expresiones regulares, por ejemplo <code class='fn__code'>foo,/[0-9]+/</code> significa excluir foo y números","fileTree2": "El árbol de documentos seleccionará automáticamente el documento actual cuando se cambie la pestaña del editor","fileTree3": "No se requiere confirmación al borrar documentos","fileTree4": "Si no se activa, aparecerá un cuadro de confirmación cada vez que se elimine un documento",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 70050d492e..ab69cbd86e 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -612,6 +612,7 @@"md38": "La longueur maximale du texte d'ancrage qui est automatiquement rendu lorsque le texte d'ancrage de la référence de bloc n'est pas personnalisé, la valeur par défaut est de <code class='fn__code'>96</code> caractères","md39": "Adresse Servo PlantUML","md40": "Laissez vide pour restaurer <code class='fn__code'>https://www.plantuml.com/plantuml/svg/~1/</code> par défaut",+ "md41": "Prend en charge l'utilisation de / pour envelopper les expressions régulières, par exemple <code class='fn__code'>foo,/[0-9]+/</code> signifie exclure foo et les nombres","fileTree2": "L'arbre des Docs sélectionne automatiquement le document en cours lorsque l'on change d'onglet d'édition","fileTree3": "Aucune confirmation requise lors de la suppression de documents","fileTree4": "Si non activé, une boîte de confirmation apparaîtra à chaque fois que vous supprimerez un document",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 76eed1250d..a18000638a 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -612,6 +612,7 @@"md38": "不自訂塊引錨文本時自動渲染錨文本的最大長度,預設為 <code class='fn__code'>96</code> 個字元","md39": "PlantUML 伺服地址","md40": "留空將恢復默認值 <code class='fn__code'>https://www.plantuml.com/plantuml/svg/~1</code>",+ "md41": "支持使用 / 包裹正則表達式,例如 <code class='fn__code'>foo,/[0-9]+/</code> 表示排除 foo 和數字","fileTree2": "在編輯器切換分頁時文檔樹會自動選中當前的文檔","fileTree3": "刪除文檔時不需要確認","fileTree4": "不啟用時每次刪除文檔都會彈出確認框",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex e157d7ac29..6bf7404d28 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -612,6 +612,7 @@"md38": "不自定义块引锚文本时自动渲染锚文本的最大长度,默认为 <code class='fn__code'>96</code> 个字符","md39": "PlantUML 伺服地址","md40": "留空将恢复默认值 <code class='fn__code'>https://www.plantuml.com/plantuml/svg/~1</code>",+ "md41": "支持使用 / 包裹正则表达式,例如 <code class='fn__code'>foo,/[0-9]+/</code> 表示排除 foo 和数字","fileTree2": "在编辑器页签切换时文档树会自动选中当前的文档","fileTree3": "删除文档时不需要确认","fileTree4": "不启用时每次删除文档都会弹出确认框",diff --git a/app/src/config/editor.ts b/app/src/config/editor.tsindex 6b73d46ede..854457ad1d 100644--- a/app/src/config/editor.ts+++ b/app/src/config/editor.ts@@ -177,6 +177,7 @@ export const editor = {<div class="fn__flex-1">${window.siyuan.languages.md35}<div class="b3-label__text">${window.siyuan.languages.md36}</div>+ <div class="b3-label__text">${window.siyuan.languages.md41}</div></div><span class="fn__space"></span><input class="b3-text-field fn__flex-center fn__size200" id="virtualBlockRefExclude" value="${window.siyuan.config.editor.virtualBlockRefExclude}" />diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.goindex cc5950e013..0e69a7273e 100644--- a/kernel/model/virutalref.go+++ b/kernel/model/virutalref.go@@ -17,6 +17,7 @@package modelimport (+ "regexp""sort""strings"@@ -97,13 +98,29 @@ func getVirtualRefKeywords(docName string) (ret []string) {if "" != strings.TrimSpace(Conf.Editor.VirtualBlockRefExclude) {exclude := strings.ReplaceAll(Conf.Editor.VirtualBlockRefExclude, "\\,", "__comma@sep__")excludes := strings.Split(exclude, ",")- var tmp []string+ var tmp, regexps []stringfor _, e := range excludes {e = strings.ReplaceAll(e, "__comma@sep__", ",")- tmp = append(tmp, e)+ if strings.HasPrefix(e, "/") && strings.HasSuffix(e, "/") {+ regexps = append(regexps, e[1:len(e)-1])+ } else {+ tmp = append(tmp, e)+ }}excludes = tmpret = gulu.Str.ExcludeElem(ret, excludes)+ if 0 < len(regexps) {+ tmp = nil+ for _, re := range regexps {+ for _, str := range ret {+ if ok, regErr := regexp.MatchString(re, str); !ok && nil == regErr {+ tmp = append(tmp, str)+ break+ }+ }+ }+ ret = tmp+ }}// 虚拟引用排除当前文档名 https://github.com/siyuan-note/siyuan/issues/4537