Skip to content

Commit

Permalink
Merge pull request #879 from Hi-Windom/v0.35
Browse files Browse the repository at this point in the history
V0.35
  • Loading branch information
Soltus authored Jul 14, 2024
2 parents 1545ce2 + 0b31fd5 commit ff8cfe3
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .vscode/extensions/Sillot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sillot",
"displayName": "汐洛 Sillot",
"description": "汐洛彖夲肜矩阵(Sillot T☳Converbenk Matrix)为智慧新彖务服务。此插件为汐洛官方插件,提供多功能一体化集成。",
"version": "0.35.24071121",
"version": "0.35.24071423",
"preview": true,
"repository": "https://github.com/Hi-Windom/Sillot",
"publisher": "Hi-Windom",
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sillot",
"version": "0.35.24071121",
"version": "0.35.24071423",
"syv": "3.1.1",
"sypv": "[3.0.16, 3.0.17, 3.1.0]",
"description": "Build Your Eternal Digital Garden",
Expand Down
2 changes: 1 addition & 1 deletion app/stage/protyle/js/lute/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/starlight/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "starlight",
"type": "module",
"version": "0.35.24071121",
"version": "0.35.24071423",
"scripts": {
"test": "echo 'Test your sister day by day'",
"dev": "astro dev",
Expand Down
3 changes: 3 additions & 0 deletions docs/starlight/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ hero:
- text: 参与社区讨论
link: https://ld246.com/tag/sillot
icon: external
- text: 下载链接
link: ./汐洛宝典/下载
icon: external
---

import { Card, CardGrid } from '@astrojs/starlight/components';
Expand Down
11 changes: 11 additions & 0 deletions docs/starlight/src/content/docs/汐洛宝典/下载.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: 下载
---

## Github release

https://github.com/Hi-Windom/Sillot/releases

## 阿里云盘

https://www.alipan.com/s/FuVG2PhBYTD 提取码: g4k1
2 changes: 1 addition & 1 deletion kernel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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.20240612035750-c9cf5f7a4d02
github.com/88250/lute v1.7.7-0.20240710135739-2bd32b79b676
github.com/88250/lute v1.7.7-0.20240714023241-170030b2261e
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
Expand Down
4 changes: 2 additions & 2 deletions kernel/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,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.20240612035750-c9cf5f7a4d02 h1:3e5+yobj655pTeKOYMbJrnc1mE51ZkbXIxquTYZuYCY=
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
github.com/88250/lute v1.7.7-0.20240710135739-2bd32b79b676 h1:7OCiXeKuY09RC072aYNVpAMEmn5rophI7gjoH3W1uvs=
github.com/88250/lute v1.7.7-0.20240710135739-2bd32b79b676/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/lute v1.7.7-0.20240714023241-170030b2261e h1:klfB4/WIBtQ02adnAgpntX9zJ7yGI847LiE5o3wknFw=
github.com/88250/lute v1.7.7-0.20240714023241-170030b2261e/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
Expand Down
20 changes: 18 additions & 2 deletions kernel/model/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,8 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
for _, col := range table.Columns {
cell := &ast.Node{Type: ast.NodeTableCell}
name := string(lex.EscapeProtyleMarkers([]byte(col.Name)))
name = strings.ReplaceAll(name, "\\|", "|")
name = strings.ReplaceAll(name, "|", "\\|")
cell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(name)})
mdTableHeadRow.AppendChild(cell)
}
Expand All @@ -2234,11 +2236,25 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
mdTableRow.AppendChild(mdTableCell)
var val string
if nil != cell.Value {
if av.KeyTypeText == cell.Value.Type {
if av.KeyTypeBlock == cell.Value.Type {
if nil != cell.Value.Block {
val = cell.Value.Block.Content
val = string(lex.EscapeProtyleMarkers([]byte(val)))
val = strings.ReplaceAll(val, "\\|", "|")
val = strings.ReplaceAll(val, "|", "\\|")
lines := strings.Split(val, "\n")
for _, line := range lines {
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(line)})
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeHardBreak})
}
continue
}
} else if av.KeyTypeText == cell.Value.Type {
if nil != cell.Value.Text {
// 文本字段需要替换换行符并转义标记符 https://github.com/siyuan-note/siyuan/issues/11945
val = cell.Value.Text.Content
val = string(lex.EscapeProtyleMarkers([]byte(val)))
val = strings.ReplaceAll(val, "\\|", "|")
val = strings.ReplaceAll(val, "|", "\\|")
lines := strings.Split(val, "\n")
for _, line := range lines {
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(line)})
Expand Down
26 changes: 22 additions & 4 deletions kernel/model/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,16 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,

ignoreLines := getRefSearchIgnoreLines()
refs := sql.QueryRefsRecent(onlyDoc, ignoreLines)
var btsID []string
for _, ref := range refs {
btsID = append(btsID, ref.DefBlockRootID)
}
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
bts := treenode.GetBlockTrees(btsID)
for _, ref := range refs {
tree := cachedTrees[ref.DefBlockRootID]
if nil == tree {
tree, _ = LoadTreeByBlockID(ref.DefBlockRootID)
tree, _ = loadTreeByBlockTree(bts[ref.DefBlockRootID])
}
if nil == tree {
continue
Expand Down Expand Up @@ -360,10 +366,16 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,

ret = fullTextSearchRefBlock(keyword, beforeLen, onlyDoc)
tmp := ret[:0]
var btsID []string
for _, b := range ret {
btsID = append(btsID, b.RootID)
}
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
bts := treenode.GetBlockTrees(btsID)
for _, b := range ret {
tree := cachedTrees[b.RootID]
if nil == tree {
tree, _ = LoadTreeByBlockID(b.RootID)
tree, _ = loadTreeByBlockTree(bts[b.RootID])
}
if nil == tree {
continue
Expand All @@ -376,7 +388,7 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets,
// `((` 引用候选中排除当前块的父块 https://github.com/siyuan-note/siyuan/issues/4538
tree := cachedTrees[b.RootID]
if nil == tree {
tree, _ = LoadTreeByBlockID(b.RootID)
tree, _ = loadTreeByBlockTree(bts[b.RootID])
cachedTrees[b.RootID] = tree
}
if nil != tree {
Expand Down Expand Up @@ -889,11 +901,17 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
rootMap := map[string]bool{}
var rootIDs []string
contentSorts := map[string]int{}
var btsID []string
for _, b := range blocks {
btsID = append(btsID, b.RootID)
}
btsID = gulu.Str.RemoveDuplicatedElem(btsID)
bts := treenode.GetBlockTrees(btsID)
for _, b := range blocks {
if _, ok := rootMap[b.RootID]; !ok {
rootMap[b.RootID] = true
rootIDs = append(rootIDs, b.RootID)
tree, _ := LoadTreeByBlockID(b.RootID)
tree, _ := loadTreeByBlockTree(bts[b.RootID])
if nil == tree {
continue
}
Expand Down
7 changes: 6 additions & 1 deletion kernel/model/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ func getRecentDocs() (ret []*RecentDoc, err error) {
return
}

var rootIDs []string
for _, doc := range tmp {
rootIDs = append(rootIDs, doc.RootID)
}
bts := treenode.GetBlockTrees(rootIDs)
var notExists []string
for _, doc := range tmp {
if bt := treenode.GetBlockTree(doc.RootID); nil != bt {
if bt := bts[doc.RootID]; nil != bt {
doc.Title = path.Base(bt.HPath) // Recent docs not updated after renaming https://github.com/siyuan-note/siyuan/issues/7827
ret = append(ret, doc)
} else {
Expand Down
5 changes: 5 additions & 0 deletions kernel/model/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ func LoadTreeByBlockID(id string) (ret *parse.Tree, err error) {
return nil, ErrTreeNotFound
}

ret, err = loadTreeByBlockTree(bt)
return
}

func loadTreeByBlockTree(bt *treenode.BlockTree) (ret *parse.Tree, err error) {
luteEngine := util.NewLute()
ret, err = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)
return
Expand Down
5 changes: 5 additions & 0 deletions kernel/treenode/blocktree.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func initDBTables() {
if nil != err {
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create table [blocktrees] failed: %s", err)
}

_, err = db.Exec("CREATE INDEX idx_blocktrees_id ON blocktrees(id)")
if nil != err {
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocktrees_id] failed: %s", err)
}
}

func initDBConnection() {
Expand Down
10 changes: 5 additions & 5 deletions kernel/util/pandoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ func ConvertPandoc(dir string, args ...string) (path string, err error) {
}

func Pandoc(from, to, o, content string) (err error) {
if "" == PandocBinPath || ContainerStd != Container {
err = ErrPandocNotFound
return
}

if "" == from || "" == to || "md" == to {
if err = gulu.File.WriteFileSafer(o, []byte(content), 0644); nil != err {
logging.LogErrorf("write export markdown file [%s] failed: %s", o, err)
}
return
}

if "" == PandocBinPath || ContainerStd != Container {
err = ErrPandocNotFound
return
}

dir := filepath.Join(WorkspaceDir, "temp", "convert", "pandoc", gulu.Rand.String(7))
if err = os.MkdirAll(dir, 0755); nil != err {
logging.LogErrorf("mkdir [%s] failed: [%s]", dir, err)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Sillot-workspace",
"version": "0.35.24071121",
"version": "0.35.24071423",
"description": "汐洛 pnpm 工作区",
"packageManager": "[email protected]",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/_pkg/Const.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
# 🚧 汐洛仅用于开发者测试,不要用来存储重要数据!
# ❄️ [国内用户推荐使用阿里云盘下载](https://sillot.db.sc.cn/汐洛宝典/下载/#阿里云盘)
🚢 [Docker image](https://hub.docker.com/r/soltus/sillot/tags?page=1&ordering=last_updated) 📦 [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=Hi-Windom.sillot) 📦 [Chromium Browser Extension(维护中)](https://github.com/K-Sillot/Sillot-Be/releases)
<span>
Expand Down

0 comments on commit ff8cfe3

Please sign in to comment.