diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 4fd34af2f..230872d06 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -49,4 +49,4 @@ jobs: - name: Build the Docker image run: | - docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v2.10.11 . \ No newline at end of file + docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v2.10.12 . \ No newline at end of file diff --git a/API.md b/API.md index 34e0f3da0..453e92d97 100644 --- a/API.md +++ b/API.md @@ -1149,7 +1149,7 @@ View API token in Settings - About, request header: `Authorization: T "/conf/appearance/boot", "/conf/appearance/langs", "/conf/appearance/emojis/conf.json", - "/conf/appearance/icons/index.html", + "/conf/appearance/icons/index.html" ], "name": "zip-file-name" } diff --git a/API_zh_CN.md b/API_zh_CN.md index 2377b1a39..4e9e221fe 100644 --- a/API_zh_CN.md +++ b/API_zh_CN.md @@ -1141,7 +1141,7 @@ "/conf/appearance/boot", "/conf/appearance/langs", "/conf/appearance/emojis/conf.json", - "/conf/appearance/icons/index.html", + "/conf/appearance/icons/index.html" ], "name": "zip-file-name" } diff --git a/app/appx/AppxManifest.xml b/app/appx/AppxManifest.xml index 58693a1bf..aed028a7c 100644 --- a/app/appx/AppxManifest.xml +++ b/app/appx/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.10.12.0"/> SiYuan 云南链滴科技有限公司 diff --git a/app/package.json b/app/package.json index bda74a525..e8c711d21 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "SiYuan", - "version": "2.10.11", + "version": "2.10.12", "description": "Refactor your thinking", "homepage": "https://b3log.org/siyuan", "main": "./electron/main.js", diff --git a/kernel/model/export.go b/kernel/model/export.go index afb39421b..bcecb3990 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1890,16 +1890,10 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool, return ast.WalkContinue } - var view *av.View - if "" != attrView.ViewID { - for _, v := range attrView.Views { - if v.ID == attrView.ViewID { - view = v - break - } - } - } else { - view = attrView.Views[0] + view, err := attrView.GetView() + if nil != err { + logging.LogErrorf("get attribute view [%s] failed: %s", avID, err) + return ast.WalkContinue } table, err := renderAttributeViewTable(attrView, view) diff --git a/kernel/model/template.go b/kernel/model/template.go index fb4052b9c..fccfe3ac2 100644 --- a/kernel/model/template.go +++ b/kernel/model/template.go @@ -290,9 +290,41 @@ func renderTemplate(p, id string, preview bool) (string, error) { if nil != cloned { n.AttributeViewID = cloned.ID if !preview { + // 非预览时持久化数据库 if saveErr := av.SaveAttributeView(cloned); nil != saveErr { logging.LogErrorf("save attribute view [%s] failed: %s", cloned.ID, saveErr) } + } else { + // 预览时使用简单表格渲染 + view, getErr := attrView.GetView() + if nil != getErr { + logging.LogErrorf("get attribute view [%s] failed: %s", n.AttributeViewID, getErr) + return ast.WalkContinue + } + + table, renderErr := renderAttributeViewTable(attrView, view) + if nil != renderErr { + logging.LogErrorf("render attribute view [%s] table failed: %s", n.AttributeViewID, renderErr) + return ast.WalkContinue + } + + var aligns []int + for range table.Columns { + aligns = append(aligns, 0) + } + mdTable := &ast.Node{Type: ast.NodeTable, TableAligns: aligns} + mdTableHead := &ast.Node{Type: ast.NodeTableHead} + mdTable.AppendChild(mdTableHead) + mdTableHeadRow := &ast.Node{Type: ast.NodeTableRow, TableAligns: aligns} + mdTableHead.AppendChild(mdTableHeadRow) + for _, col := range table.Columns { + cell := &ast.Node{Type: ast.NodeTableCell} + cell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(col.Name)}) + mdTableHeadRow.AppendChild(cell) + } + + n.InsertBefore(mdTable) + unlinks = append(unlinks, n) } } } diff --git a/kernel/util/working.go b/kernel/util/working.go index 7349669ab..7b83838cf 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -42,7 +42,7 @@ import ( var Mode = "prod" const ( - Ver = "2.10.11" + Ver = "2.10.12" IsInsider = false )