Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-09-21 00:36:50 +08:00
commit 3fbf1b3a24
3 changed files with 22 additions and 3 deletions

View file

@ -1063,7 +1063,7 @@
"export20": "La exportación de archivos Word .docx requiere la conversión del formato mediante <a href=\"https://pandoc.org\" target=\"_blank\">Pandoc</a>",
"export21": "Exportar plantilla de pie de página PDF",
"export22": "<code class='fn__code'>%page</code> es el número de página actual, <code class='fn__code'>%pages</code> 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 <a href=\"https://pandoc.org/MANUAL.html#option--reference-doc\" target =\"_blank\">--reference-doc</a> valor del parámetro",

View file

@ -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()

View file

@ -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
}