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

This commit is contained in:
Vanessa 2024-09-30 10:57:33 +08:00
commit 80da2518e4
6 changed files with 54 additions and 35 deletions

View file

@ -8,7 +8,6 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check tag aka check release type
id: checktag
run: |
@ -29,10 +28,6 @@ jobs:
id: get_version_without_v
run: echo ::set-output name=TAG_VERSION_WITHOUT_V::$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
- name: Extract package_file_name
id: get_package_file_name
run: echo ::set-output name=PACKAGE_FILE_NAME::siyuan-${{ steps.get_version_without_v.outputs.TAG_VERSION_WITHOUT_V }}-linux.AppImage
- name: Create PKGBUILD
run: |
cat << EOF >> PKGBUILD
@ -40,35 +35,37 @@ jobs:
# auto running on siyuan official repo
# PKGBUILD is modified from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=siyuan-appimage
# which is made by vvxxp8 <concatenate[g] the characters[x] in square[b] brackets[1] in[5] order[3] at gmail dot com>
pkgname=siyuan_stable
pkgver=${{ steps.get_version.outputs.TAG_VERSION }}
pkgrel=0
# had agreement with the author to use the PKGBUILD
# for change request, PLEASE MAKE A PR ON GITHUB REPO, keep commenting here would be ignored
pkgname=siyuan-bin
pkgver=${{ steps.get_version_without_v.outputs.TAG_VERSION_WITHOUT_V }}
pkgrel=1
pkgdesc="auto upload to AUR when SiYuan stable release"
arch=("x86_64")
url="https://b3log.org/siyuan"
license=("AGPL-3.0-only")
_pkgname=${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }}
noextract=(${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }})
_pkgname=siyuan-\${pkgver}-linux.AppImage
noextract=(siyuan-\${pkgver}-linux.AppImage)
options=("!strip" "!debug")
depends=("fuse2")
optdepends=('pandoc: docx export')
source=("\${_pkgname}::https://github.com/siyuan-note/siyuan/releases/download/${{ steps.get_version.outputs.TAG_VERSION }}/${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }}")
source=("https://github.com/siyuan-note/siyuan/releases/download/v\${pkgver}/siyuan-\${pkgver}-linux.AppImage")
sha256sums=('SKIP')
_installdir=/opt/appimages
prepare() {
chmod a+x \${_pkgname}
./\${_pkgname} --appimage-extract >/dev/null
sed -i "s+AppRun+\${_installdir}/siyuan.AppImage+" "squashfs-root/siyuan.desktop"
sed -i "s+^Icon=.*+Icon=siyuan_stable+" "squashfs-root/siyuan.desktop"
sed -i "s+^Icon=.*+Icon=siyuan-bin+" "squashfs-root/siyuan.desktop"
}
package() {
install -Dm755 \${_pkgname} "\${pkgdir}/\${_installdir}/siyuan.AppImage"
install -Dm644 "squashfs-root/resources/stage/icon.png" "\${pkgdir}/usr/share/icons/hicolor/512x512/apps/siyuan_stable.png"
install -Dm644 "squashfs-root/siyuan.desktop" "\${pkgdir}/usr/share/applications/siyuan_stable.desktop"
install -Dm644 "squashfs-root/resources/stage/icon.png" "\${pkgdir}/usr/share/icons/hicolor/512x512/apps/siyuan-bin.png"
install -Dm644 "squashfs-root/siyuan.desktop" "\${pkgdir}/usr/share/applications/siyuan-bin.desktop"
if [ ! -f "${pkgdir}/usr/bin/siyuan" ]; then
mkdir -p "${pkgdir}/usr/bin"
@ -82,7 +79,7 @@ jobs:
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
with:
pkgname: siyuan_stable
pkgname: siyuan-bin
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}

View file

@ -2,6 +2,7 @@ import {Dialog} from "../dialog";
import {fetchPost} from "./fetch";
import {isMobile} from "./functions";
import {Constants} from "../constants";
import {pathPosix} from "./pathName";
// 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
export const renameTag = (labelName: string) => {
@ -31,7 +32,7 @@ export const renameTag = (labelName: string) => {
};
export const getWorkspaceName = () => {
return window.siyuan.config.system.workspaceDir.replace(/^.*[\\\/]/, "");
return pathPosix().basename(window.siyuan.config.system.workspaceDir.replace(/\\/g, "/"));
};
export const checkFold = (id: string, cb: (zoomIn: boolean, action: string[], isRoot: boolean) => void) => {

File diff suppressed because one or more lines are too long

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.20240612035750-c9cf5f7a4d02
github.com/88250/lute v1.7.7-0.20240929014232-4aefefe54695
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8
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

View file

@ -16,6 +16,8 @@ github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02 h1:3e5+yobj655pTeKOYM
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
github.com/88250/lute v1.7.7-0.20240929014232-4aefefe54695 h1:Lka2ckqIllp+uIAaM2HphTaB+af9Vi1ctdrghyvsg6U=
github.com/88250/lute v1.7.7-0.20240929014232-4aefefe54695/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8 h1:H4xW2ISiAaRm5SPjZD30JU6h9nUTlMGMGe0TjU2T3Rs=
github.com/88250/lute v1.7.7-0.20240929140516-3e8e6c2366d8/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=

View file

@ -1540,21 +1540,23 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
trees := map[string]*parse.Tree{}
refTrees := map[string]*parse.Tree{}
for _, p := range docPaths {
for i, p := range docPaths {
docIAL := box.docIAL(p)
if nil == docIAL {
continue
}
msg := Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), fmt.Sprintf("%d/%d %s", i+1, len(docPaths), docIAL["title"]))
util.PushEndlessProgress(msg)
id := docIAL["id"]
tree, err := LoadTreeByBlockID(id)
if err != nil {
continue
}
trees[tree.ID] = tree
}
for _, tree := range trees {
refs := exportRefTrees(tree)
refs := exportRefTrees(tree, trees)
for refTreeID, refTree := range refs {
if nil == trees[refTreeID] {
refTrees[refTreeID] = refTree
@ -1562,6 +1564,8 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
}
}
util.PushEndlessProgress(Conf.Language(65))
// 按文件夹结构复制选择的树
for _, tree := range trees {
readPath := filepath.Join(util.DataDir, tree.Box, tree.Path)
@ -2722,13 +2726,13 @@ type refAsFootnotes struct {
refAnchorText string
}
func exportRefTrees(tree *parse.Tree) (ret map[string]*parse.Tree) {
func exportRefTrees(tree *parse.Tree, treeCache map[string]*parse.Tree) (ret map[string]*parse.Tree) {
ret = map[string]*parse.Tree{}
exportRefTrees0(tree, &ret)
exportRefTrees0(tree, &ret, treeCache)
return
}
func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree) {
func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree, treeCache map[string]*parse.Tree) {
if nil != (*retTrees)[tree.ID] {
return
}
@ -2748,12 +2752,20 @@ func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree) {
if nil == defBlock {
return ast.WalkSkipChildren
}
defTree, err := LoadTreeByBlockID(defBlock.RootID)
if err != nil {
return ast.WalkSkipChildren
var defTree *parse.Tree
var err error
if treeCache[defBlock.RootID] != nil {
defTree = treeCache[defBlock.RootID]
} else {
defTree, err = LoadTreeByBlockID(defBlock.RootID)
if err != nil {
return ast.WalkSkipChildren
}
treeCache[defBlock.RootID] = defTree
}
exportRefTrees0(defTree, retTrees)
exportRefTrees0(defTree, retTrees, treeCache)
} else if ast.NodeAttributeView == n.Type {
// 导出数据库所在文档时一并导出绑定块所在文档
// Export the binding block docs when exporting the doc where the database is located https://github.com/siyuan-note/siyuan/issues/11486
@ -2779,12 +2791,19 @@ func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree) {
continue
}
defTree, _ := LoadTreeByBlockID(defBlock.RootID)
if nil == defTree {
continue
var defTree *parse.Tree
var err error
if treeCache[defBlock.RootID] != nil {
defTree = treeCache[defBlock.RootID]
} else {
defTree, err = LoadTreeByBlockID(defBlock.RootID)
if err != nil {
continue
}
treeCache[defBlock.RootID] = defTree
}
exportRefTrees0(defTree, retTrees)
exportRefTrees0(defTree, retTrees, treeCache)
}
}
return ast.WalkContinue