mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Improve error tip when renaming tags/bookmarks containing Markdown markers Fix https://github.com/siyuan-note/siyuan/issues/9248
This commit is contained in:
parent
20cd3c5f80
commit
4283f73407
8 changed files with 13 additions and 13 deletions
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Remove reminder completed [%s]",
|
"109": "Remove reminder completed [%s]",
|
||||||
"110": "Renaming...",
|
"110": "Renaming...",
|
||||||
"111": "Saving document [%s]...",
|
"111": "Saving document [%s]...",
|
||||||
"112": "Do not include Markdown syntax marker",
|
"112": "Do not include Markdown syntax marker [%s]",
|
||||||
"113": "Completing data writing...",
|
"113": "Completing data writing...",
|
||||||
"114": "Tag cannot be empty",
|
"114": "Tag cannot be empty",
|
||||||
"115": "Please configure [Settings - Export - Pandoc executable path] first",
|
"115": "Please configure [Settings - Export - Pandoc executable path] first",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Eliminación de recordatorios completada [%s]",
|
"109": "Eliminación de recordatorios completada [%s]",
|
||||||
"110": "Renombrar...",
|
"110": "Renombrar...",
|
||||||
"111": "Guardando documento [%s]...",
|
"111": "Guardando documento [%s]...",
|
||||||
"112": "No incluir marcador de sintaxis Markdown",
|
"112": "No incluir marcador de sintaxis Markdown [%s]",
|
||||||
"113": "Completando la escritura de datos...",
|
"113": "Completando la escritura de datos...",
|
||||||
"114": "La etiqueta no puede estar vacía",
|
"114": "La etiqueta no puede estar vacía",
|
||||||
"115": "Por favor, configure primero [Configuración - Exportación - Ruta ejecutable de Pandoc]",
|
"115": "Por favor, configure primero [Configuración - Exportación - Ruta ejecutable de Pandoc]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Supprimer le rappel terminé [%s]",
|
"109": "Supprimer le rappel terminé [%s]",
|
||||||
"110": "Renommer...",
|
"110": "Renommer...",
|
||||||
"111": "Enregistrement du document [%s]...",
|
"111": "Enregistrement du document [%s]...",
|
||||||
"112": "Ne pas inclure les balises de syntaxe Markdown",
|
"112": "Ne pas inclure les balises de syntaxe Markdown [%s]",
|
||||||
"113": "Fin de l'écriture des données...",
|
"113": "Fin de l'écriture des données...",
|
||||||
"114": "La balise ne peut pas être vide",
|
"114": "La balise ne peut pas être vide",
|
||||||
"115": "Veuillez d'abord configurer [Paramètres - Exporter - Chemin de l'exécutable Pandoc]",
|
"115": "Veuillez d'abord configurer [Paramètres - Exporter - Chemin de l'exécutable Pandoc]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "移除提醒完畢 [%s]",
|
"109": "移除提醒完畢 [%s]",
|
||||||
"110": "正在重命名...",
|
"110": "正在重命名...",
|
||||||
"111": "正在保存文檔 [%s]...",
|
"111": "正在保存文檔 [%s]...",
|
||||||
"112": "請勿包含 Markdown 語法標記符",
|
"112": "請勿包含 Markdown 語法標記符 [%s]",
|
||||||
"113": "正在完成資料寫入...",
|
"113": "正在完成資料寫入...",
|
||||||
"114": "標籤不能為空",
|
"114": "標籤不能為空",
|
||||||
"115": "請先配置 [設置 - 導出 - Pandoc 可執行文件路徑]",
|
"115": "請先配置 [設置 - 導出 - Pandoc 可執行文件路徑]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "移除提醒完毕 [%s]",
|
"109": "移除提醒完毕 [%s]",
|
||||||
"110": "正在重命名...",
|
"110": "正在重命名...",
|
||||||
"111": "正在保存文档 [%s]...",
|
"111": "正在保存文档 [%s]...",
|
||||||
"112": "请勿包含 Markdown 语法标记符",
|
"112": "请勿包含 Markdown 语法标记符 [%s]",
|
||||||
"113": "正在完成数据写入...",
|
"113": "正在完成数据写入...",
|
||||||
"114": "标签不能为空",
|
"114": "标签不能为空",
|
||||||
"115": "请先配置 [设置 - 导出 - Pandoc 可执行文件路径]",
|
"115": "请先配置 [设置 - 导出 - Pandoc 可执行文件路径]",
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ func RemoveBookmark(bookmark string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenameBookmark(oldBookmark, newBookmark string) (err error) {
|
func RenameBookmark(oldBookmark, newBookmark string) (err error) {
|
||||||
if treenode.ContainsMarker(newBookmark) {
|
if invalidChar := treenode.ContainsMarker(newBookmark); "" != invalidChar {
|
||||||
return errors.New(Conf.Language(112))
|
return errors.New(fmt.Sprintf(Conf.Language(112), invalidChar))
|
||||||
}
|
}
|
||||||
|
|
||||||
newBookmark = strings.TrimSpace(newBookmark)
|
newBookmark = strings.TrimSpace(newBookmark)
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ func RemoveTag(label string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenameTag(oldLabel, newLabel string) (err error) {
|
func RenameTag(oldLabel, newLabel string) (err error) {
|
||||||
if treenode.ContainsMarker(newLabel) {
|
if invalidChar := treenode.ContainsMarker(newLabel); "" != invalidChar {
|
||||||
return errors.New(Conf.Language(112))
|
return errors.New(fmt.Sprintf(Conf.Language(112), invalidChar))
|
||||||
}
|
}
|
||||||
|
|
||||||
newLabel = strings.TrimSpace(newLabel)
|
newLabel = strings.TrimSpace(newLabel)
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,17 @@ import (
|
||||||
"github.com/88250/lute/lex"
|
"github.com/88250/lute/lex"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ContainsMarker(str string) bool {
|
func ContainsMarker(str string) (ret string) {
|
||||||
if !gulu.Str.IsASCII(str) {
|
if !gulu.Str.IsASCII(str) {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, token := range str {
|
for _, token := range str {
|
||||||
if IsMarker(byte(token)) {
|
if IsMarker(byte(token)) {
|
||||||
return true
|
return string(token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsMarker(token byte) bool {
|
func IsMarker(token byte) bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue