From 2472c631779288641513d9556f80e6189beb671d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 20 Sep 2024 11:49:07 +0800 Subject: [PATCH 1/2] :art: Browser clipping extension supports configuring document tags https://github.com/siyuan-note/siyuan/issues/10797 --- kernel/api/filetree.go | 8 +++++++- kernel/model/file.go | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go index 405b7d20d..d1a9c5762 100644 --- a/kernel/api/filetree.go +++ b/kernel/api/filetree.go @@ -673,6 +673,12 @@ func createDocWithMd(c *gin.Context) { return } + tagsArg := arg["tags"] + var tags string + if nil != tagsArg { + tags = tagsArg.(string) + } + var parentID string parentIDArg := arg["parentID"] if nil != parentIDArg { @@ -706,7 +712,7 @@ func createDocWithMd(c *gin.Context) { withMath = withMathArg.(bool) } - id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, id, withMath) + id, err := model.CreateWithMarkdown(tags, notebook, hPath, markdown, parentID, id, withMath) if err != nil { ret.Code = -1 ret.Msg = err.Error() diff --git a/kernel/model/file.go b/kernel/model/file.go index 5765b5d93..320eba633 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1159,7 +1159,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree return } -func CreateWithMarkdown(boxID, hPath, md, parentID, id string, withMath bool) (retID string, err error) { +func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bool) (retID string, err error) { createDocLock.Lock() defer createDocLock.Unlock() @@ -1177,6 +1177,19 @@ func CreateWithMarkdown(boxID, hPath, md, parentID, id string, withMath bool) (r luteEngine.SetHTMLTag2TextMark(true) dom := luteEngine.Md2BlockDOM(md, false) retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id) + + nameValues := map[string]string{} + tags = strings.TrimSpace(tags) + tags = strings.ReplaceAll(tags, ",", ",") + tagArray := strings.Split(tags, ",") + var tmp []string + for _, tag := range tagArray { + tmp = append(tmp, strings.TrimSpace(tag)) + } + tags = strings.Join(tmp, ",") + nameValues["tags"] = tags + SetBlockAttrs(retID, nameValues) + WaitForWritingFiles() return } From 8639f424ff6529f67e8862d89a0340b6b968c18b Mon Sep 17 00:00:00 2001 From: Andreas <43118918+eulores@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:49:33 +0200 Subject: [PATCH 2/2] :memo: correct descuento to Markdown, see #12531 (#12532) --- app/appearance/langs/es_ES.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 06c61d652..933603eb6 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1063,7 +1063,7 @@ "export20": "La exportación de archivos Word .docx requiere la conversión del formato mediante Pandoc", "export21": "Exportar plantilla de pie de página PDF", "export22": "%page es el número de página actual, %pages es el número de página total y es compatible con las funciones de plantilla de Sprig ", - "export23": "Exportar descuento con YAML front-matter", + "export23": "Exportar Markdown con YAML front-matter", "export24": "Después de habilitar, agregue información general de metadatos al comienzo del archivo Markdown exportado", "export25": "Exportar ruta de plantilla .docx de Word", "export26": "La ruta absoluta de la plantilla utilizada al exportar archivos .docx de Word, es decir, Pandoc --reference-doc valor del parámetro",