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

This commit is contained in:
Vanessa 2025-06-14 09:48:37 +08:00
commit 96a7b4a03e
8 changed files with 62 additions and 29 deletions

File diff suppressed because one or more lines are too long

View file

@ -426,7 +426,12 @@ func exportMdContent(c *gin.Context) {
yfm = arg["yfm"].(bool)
}
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm)
fillCSSVar := false
if nil != arg["fillCSSVar"] {
fillCSSVar = arg["fillCSSVar"].(bool)
}
hPath, content := model.ExportMarkdownContent(id, refMode, embedMode, yfm, fillCSSVar)
ret.Data = map[string]interface{}{
"hPath": hPath,
"content": content,

View file

@ -421,6 +421,14 @@ func SaveAttributeView(av *AttributeView) (err error) {
view.Table.PageSize = TableViewDefaultPageSize
}
}
if nil != view.Gallery {
// 行去重
view.Gallery.CardIDs = gulu.Str.RemoveDuplicatedElem(view.Gallery.CardIDs)
// 分页大小
if 1 > view.Gallery.PageSize {
view.Gallery.PageSize = GalleryViewDefaultPageSize
}
}
}
var data []byte
@ -587,16 +595,31 @@ func (av *AttributeView) Clone() (ret *AttributeView) {
for _, view := range ret.Views {
view.ID = ast.NewNodeID()
view.Table.ID = ast.NewNodeID()
for _, column := range view.Table.Columns {
column.ID = keyIDMap[column.ID]
}
view.Table.RowIDs = []string{}
switch view.LayoutType {
case LayoutTypeTable:
for _, column := range view.Table.Columns {
column.ID = keyIDMap[column.ID]
}
view.Table.RowIDs = []string{}
for _, f := range view.Table.Filters {
f.Column = keyIDMap[f.Column]
}
for _, s := range view.Table.Sorts {
s.Column = keyIDMap[s.Column]
for _, f := range view.Table.Filters {
f.Column = keyIDMap[f.Column]
}
for _, s := range view.Table.Sorts {
s.Column = keyIDMap[s.Column]
}
case LayoutTypeGallery:
for _, cardField := range view.Gallery.CardFields {
cardField.ID = keyIDMap[cardField.ID]
}
view.Gallery.CardIDs = []string{}
for _, f := range view.Gallery.Filters {
f.Column = keyIDMap[f.Column]
}
for _, s := range view.Gallery.Sorts {
s.Column = keyIDMap[s.Column]
}
}
}
ret.ViewID = ret.Views[0].ID

View file

@ -10,7 +10,7 @@ require (
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689
github.com/88250/lute v1.7.7-0.20250611081108-1548cf781cff
github.com/88250/lute v1.7.7-0.20250614000910-93dd30c355d0
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
github.com/ConradIrwin/font v0.2.1

View file

@ -14,10 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689 h1:39y5g7vnFAIcXhTN3IXPk7h2xBhC4a9hBTykDhHJqRY=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689/go.mod h1:c8uVw25vW2W4dhJ/j4iYsX5H1hc19spim266jO5x2hU=
github.com/88250/lute v1.7.7-0.20250528131435-ac9ea77e3cfb h1:k/6TqVSR6kknCOkEfcYs+q+RVKcAhoSfczsIWQiZbAM=
github.com/88250/lute v1.7.7-0.20250528131435-ac9ea77e3cfb/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/lute v1.7.7-0.20250611081108-1548cf781cff h1:9YvuT2OFoyn0JI2dKEjgpycwsGfTnfLuhX3oRS7EjKs=
github.com/88250/lute v1.7.7-0.20250611081108-1548cf781cff/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/lute v1.7.7-0.20250614000910-93dd30c355d0 h1:VZvTvCBy1Xa6hcxi+xvYCSMGbk4nh1ThzYNl8/f7mNQ=
github.com/88250/lute v1.7.7-0.20250614000910-93dd30c355d0/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
@ -467,8 +465,6 @@ golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.28.0 h1:gdem5JW1OLS4FbkWgLO+7ZeFzYtL3xClb97GaUzYMFE=
golang.org/x/image v0.28.0/go.mod h1:GUJYXtnGKEUgggyzh+Vxt+AviiCcyiwpsl8iQ8MvwGY=
golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de h1:WuckfUoaRGJfaQTPZvlmcaQwg4Xj9oS2cvvh3dUqpDo=
golang.org/x/mobile v0.0.0-20250305212854-3a7bc9f8a4de/go.mod h1:/IZuixag1ELW37+FftdmIt59/3esqpAWM/QqWtf7HUI=
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f h1:/n+PL2HlfqeSiDCuhdBbRNlGS/g2fM4OHufalHaTVG8=
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f/go.mod h1:ESkJ836Z6LpG6mTVAhA48LpfW/8fNR0ifStlH2axyfg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=

View file

@ -2602,7 +2602,12 @@ func removeAttributeViewBlock(srcIDs []string, avID string, tx *Transaction) (er
for _, view := range attrView.Views {
for _, blockID := range srcIDs {
view.Table.RowIDs = gulu.Str.RemoveElem(view.Table.RowIDs, blockID)
switch view.LayoutType {
case av.LayoutTypeTable:
view.Table.RowIDs = gulu.Str.RemoveElem(view.Table.RowIDs, blockID)
case av.LayoutTypeGallery:
view.Gallery.CardIDs = gulu.Str.RemoveElem(view.Gallery.CardIDs, blockID)
}
}
}

View file

@ -272,7 +272,7 @@ func Export2Liandi(id string) (err error) {
".md", 3, 1, 1,
"#", "#",
"", "",
false, false, nil, true, &map[string]*parse.Tree{})
false, false, nil, true, false, &map[string]*parse.Tree{})
result := gulu.Ret.NewResult()
request := httpclient.NewCloudRequest30s()
request = request.
@ -1491,7 +1491,7 @@ func ExportStdMarkdown(id string, assetsDestSpace2Underscore bool) string {
".md", Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, true, &map[string]*parse.Tree{})
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, true, false, &map[string]*parse.Tree{})
}
func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath string) {
@ -1973,7 +1973,7 @@ func walkRelationAvs(avID string, exportAvIDs *hashset.Set) {
}
}
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm bool) (hPath, exportedMd string) {
func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar bool) (hPath, exportedMd string) {
bt := treenode.GetBlockTree(id)
if nil == bt {
return
@ -1985,7 +1985,7 @@ func ExportMarkdownContent(id string, refMode, embedMode int, addYfm bool) (hPat
".md", refMode, embedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
Conf.Export.AddTitle, Conf.Export.InlineMemo, nil, true, &map[string]*parse.Tree{})
Conf.Export.AddTitle, Conf.Export.InlineMemo, nil, true, fillCSSVar, &map[string]*parse.Tree{})
docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
if addYfm {
exportedMd = yfm(docIAL) + exportedMd
@ -2004,7 +2004,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, singleFile, treeCache)
Conf.Export.AddTitle, Conf.Export.InlineMemo, defBlockIDs, singleFile, true, treeCache)
docIAL := parse.IAL2Map(tree.Root.KramdownIAL)
if Conf.Export.MarkdownYFM {
// 导出 Markdown 时在文档头添加 YFM 开关 https://github.com/siyuan-note/siyuan/issues/7727
@ -2016,7 +2016,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri
func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDestSpace2Underscore bool,
ext string, blockRefMode, blockEmbedMode, fileAnnotationRefMode int,
tagOpenMarker, tagCloseMarker string, blockRefTextLeft, blockRefTextRight string,
addTitle, inlineMemo bool, defBlockIDs []string, singleFile bool, treeCache *map[string]*parse.Tree) (ret string) {
addTitle, inlineMemo bool, defBlockIDs []string, singleFile, fillCSSVar bool, treeCache *map[string]*parse.Tree) (ret string) {
tree = exportTree(tree, false, false, false,
blockRefMode, blockEmbedMode, fileAnnotationRefMode,
tagOpenMarker, tagCloseMarker,
@ -2123,6 +2123,10 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
unlink.Unlink()
}
if fillCSSVar {
fillThemeStyleVar(tree)
}
luteEngine.SetUnorderedListMarker("-")
renderer := render.NewProtyleExportMdRenderer(tree, luteEngine.RenderOptions)
ret = gulu.Str.FromBytes(renderer.Render())

View file

@ -162,8 +162,8 @@ func fillAttributeViewGalleryCardCover(attrView *av.AttributeView, view *av.View
break
}
if titleImgCss := node.IALAttr("title-img"); "" != titleImgCss {
galleryCard.CoverURL = titleImgCss
if titleImgCSS := node.IALAttr("title-img"); "" != titleImgCSS {
galleryCard.CoverURL = titleImgCSS
break
}
}