mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Export related flashcard data when exporting .sy.zip https://github.com/siyuan-note/siyuan/issues/9372
This commit is contained in:
parent
2ca7253d1f
commit
a8806968d0
3 changed files with 72 additions and 2 deletions
|
|
@ -46,6 +46,7 @@ import (
|
|||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/riff"
|
||||
"github.com/siyuan-note/siyuan/kernel/av"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
|
|
@ -1382,6 +1383,27 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
|
|||
})
|
||||
}
|
||||
|
||||
// 导出闪卡 Export related flashcard data when exporting .sy.zip https://github.com/siyuan-note/siyuan/issues/9372
|
||||
exportStorageRiffDir := filepath.Join(exportFolder, "storage", "riff")
|
||||
deckID := ast.NewNodeID()
|
||||
deck, loadErr := riff.LoadDeck(exportStorageRiffDir, deckID, Conf.Flashcard.RequestRetention, Conf.Flashcard.MaximumInterval, Conf.Flashcard.Weights)
|
||||
for _, tree := range trees {
|
||||
cards := getTreeFlashcards(tree.ID)
|
||||
if nil != loadErr {
|
||||
logging.LogErrorf("load deck [%s] failed: %s", name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
for _, card := range cards {
|
||||
deck.AddCard(card.ID(), card.BlockID())
|
||||
}
|
||||
}
|
||||
if 0 < deck.CountCards() {
|
||||
if saveErr := deck.Save(); nil != saveErr {
|
||||
logging.LogErrorf("save deck [%s] failed: %s", name, saveErr)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出自定义排序
|
||||
sortPath := filepath.Join(util.DataDir, box.ID, ".siyuan", "sort.json")
|
||||
fullSortIDs := map[string]int{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue