Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
57d521cba4
22 changed files with 70 additions and 72 deletions
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Blockzitat",
|
||||
"export2": "Ankertext mit Block-URL",
|
||||
"export3": "Nur Ankertext",
|
||||
"export4": "Fußnoten",
|
||||
"export4": "Fußnoten+Ankerhash",
|
||||
"export5": "PDF-Annotation Referenz",
|
||||
"export6": "Über die Verarbeitung von Ankertext in PDF-Annotationen beim Exportieren",
|
||||
"export7": "Dateiname - Seitennummer - Ankertext",
|
||||
"export8": "Nur Ankertext",
|
||||
"export9": "Ankerhash",
|
||||
"graphConfig2": "Referenzanzahlfilter",
|
||||
"selectOpen": "Immer geöffnetes Dokument auswählen",
|
||||
"selectOpen1": "Ausgewähltes geöffnetes Dokument",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Blockquote",
|
||||
"export2": "Anchor text with block URL",
|
||||
"export3": "Just anchor text",
|
||||
"export4": "Footnotes",
|
||||
"export4": "Footnotes+Anchor hash",
|
||||
"export5": "PDF Annotation Ref",
|
||||
"export6": "About the handling of anchor text in PDF annotations when exporting",
|
||||
"export7": "File Name - Page Number - Anchor Text",
|
||||
"export8": "Just anchor text",
|
||||
"export9": "Anchor hash",
|
||||
"graphConfig2": "Reference Count filter",
|
||||
"selectOpen": "Always Select Opened Doc",
|
||||
"selectOpen1": "Select Opened Doc",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Bloque de cita",
|
||||
"export2": "Texto de anclaje con URL de bloque",
|
||||
"export3": "Sólo texto de anclaje",
|
||||
"export4": "Notas a pie de página",
|
||||
"export4": "Notas a pie de página+Hash de anclaje",
|
||||
"export5": "Ref. de anotación en PDF",
|
||||
"export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar",
|
||||
"export7": "Nombre de archivo - Número de página - Texto ancla",
|
||||
"export8": "Sólo texto ancla",
|
||||
"export9": "Hash de anclaje",
|
||||
"graphConfig2": "Filtro de recuento de referencias",
|
||||
"selectOpen": "Seleccionar siempre el documento abierto",
|
||||
"selectOpen1": "Seleccionar documento abierto",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Citation de bloc",
|
||||
"export2": "Texte d'ancrage avec bloc URL",
|
||||
"export3": "Juste du texte d'ancrage",
|
||||
"export4": "Notes de bas de page",
|
||||
"export4": "Notes de bas de page+Hash d'ancrage",
|
||||
"export5": "Référence d'annotation PDF",
|
||||
"export6": "À propos de la gestion du texte d'ancrage dans les annotations PDF lors de l'exportation",
|
||||
"export7": "Nom de fichier - Numéro de page - Texte d'ancrage",
|
||||
"export8": "Anchor text only",
|
||||
"export9": "Hash d'ancrage",
|
||||
"graphConfig2": "Filtre de compte de blocs de référence",
|
||||
"selectOpen": "Localisez toujours les documents ouverts",
|
||||
"selectOpen1": "Localiser les documents ouverts",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "ציטוט",
|
||||
"export2": "טקסט עוגן עם קישור בלוק",
|
||||
"export3": "רק טקסט עוגן",
|
||||
"export4": "הערות שוליים",
|
||||
"export4": "ההאש של העוגן+הערות שוליים",
|
||||
"export5": "הערות PDF",
|
||||
"export6": "על טיפולי טקסט עוגן בהערות PDF בעת הייצוא",
|
||||
"export7": "שם הקובץ - מספר עמוד - טקסט עוגן",
|
||||
"export8": "רק טקסט עוגן",
|
||||
"export9": "ההאש של העוגן",
|
||||
"graphConfig2": "מסנן ספירת הפניות",
|
||||
"selectOpen": "בחר תמיד את המסמך הפתוח",
|
||||
"selectOpen1": "בחר את המסמך הפתוח",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Citazione",
|
||||
"export2": "Testo dell'ancora con URL del blocco",
|
||||
"export3": "Solo testo dell'ancora",
|
||||
"export4": "Note a piè di pagina",
|
||||
"export4": "Note a piè di pagina+Hash dell'ancora",
|
||||
"export5": "Riferimento annotazione PDF",
|
||||
"export6": "Riguardo alla gestione del testo dell'ancora nelle annotazioni PDF durante l'esportazione",
|
||||
"export7": "Nome file - Numero pagina - Testo dell'ancora",
|
||||
"export8": "Solo testo dell'ancora",
|
||||
"export9": "Hash dell'ancora",
|
||||
"graphConfig2": "Filtro Conteggio Riferimenti",
|
||||
"selectOpen": "Seleziona sempre il documento aperto",
|
||||
"selectOpen1": "Seleziona Documento Aperto",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "ブロック参照",
|
||||
"export2": "ブロック URL 付きアンカーテキスト",
|
||||
"export3": "アンカーテキストのみ",
|
||||
"export4": "脚注",
|
||||
"export4": "脚注+アンカーハッシュ",
|
||||
"export5": "PDF 注釈の参照",
|
||||
"export6": "エクスポート時の PDF 注釈内のアンカーテキストの処理方法",
|
||||
"export7": "ファイル名 - ページ番号 - アンカーテキスト",
|
||||
"export8": "アンカーテキストのみ",
|
||||
"export9": "アンカーハッシュ",
|
||||
"graphConfig2": "参照カウントフィルタ",
|
||||
"selectOpen": "常に開いているドキュメントを選択",
|
||||
"selectOpen1": "開いているドキュメントをツリーで選択",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Cytat",
|
||||
"export2": "Tekst kotwicy z URL bloku",
|
||||
"export3": "Tylko tekst kotwicy",
|
||||
"export4": "Przypisy",
|
||||
"export4": "Przypisy+Hash kotwicy",
|
||||
"export5": "Odnośnik do adnotacji PDF",
|
||||
"export6": "O sposobie obsługi tekstu kotwicy w adnotacjach PDF podczas eksportu",
|
||||
"export7": "Nazwa pliku - Numer strony - Tekst kotwicy",
|
||||
"export8": "Tylko tekst kotwicy",
|
||||
"export9": "Hash kotwicy",
|
||||
"graphConfig2": "Filtr liczby odniesień",
|
||||
"selectOpen": "Zawsze wybieraj otwarty dokument",
|
||||
"selectOpen1": "Wybierz otwarty dokument",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "Цитата",
|
||||
"export2": "Текст якоря с URL блока",
|
||||
"export3": "Просто текст якоря",
|
||||
"export4": "Подписи",
|
||||
"export4": "Подписи+Якорь хэш",
|
||||
"export5": "PDF аннотация ссылка",
|
||||
"export6": "О том, как обрабатывать текст якоря в PDF аннотациях при экспорте",
|
||||
"export7": "Имя файла - Номер страницы - Текст якоря",
|
||||
"export8": "Просто текст якоря",
|
||||
"export9": "Якорь хэш",
|
||||
"graphConfig2": "Фильтр по количеству ссылок",
|
||||
"selectOpen": "Всегда выбирать открытый документ",
|
||||
"selectOpen1": "Выбрать открытый документ",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "引述塊",
|
||||
"export2": "錨文字塊鏈",
|
||||
"export3": "僅錨文字",
|
||||
"export4": "註腳",
|
||||
"export4": "註腳+錨點哈希",
|
||||
"export5": "PDF 標註引用",
|
||||
"export6": "導出時關於 PDF 標註引出處錨文字的處理方式",
|
||||
"export7": "文件名 - 頁碼 - 錨文字",
|
||||
"export8": "僅錨文字",
|
||||
"export9": "錨點哈希",
|
||||
"graphConfig2": "引用塊次數過濾",
|
||||
"selectOpen": "定位打開的文檔",
|
||||
"selectOpen1": "定位打開的文檔",
|
||||
|
|
|
@ -1110,12 +1110,11 @@
|
|||
"export1": "引述块",
|
||||
"export2": "锚文本块链",
|
||||
"export3": "仅锚文本",
|
||||
"export4": "脚注",
|
||||
"export4": "脚注+锚点哈希",
|
||||
"export5": "PDF 标注引用",
|
||||
"export6": "导出时关于 PDF 标注引出处锚文本的处理方式",
|
||||
"export7": "文件名 - 页码 - 锚文本",
|
||||
"export8": "仅锚文本",
|
||||
"export9": "锚点哈希",
|
||||
"graphConfig2": "引用块次数过滤",
|
||||
"selectOpen": "始终定位打开的文档",
|
||||
"selectOpen1": "定位打开的文档",
|
||||
|
|
|
@ -49,7 +49,6 @@ export const exportConfig = {
|
|||
<option value="2" ${window.siyuan.config.export.blockRefMode === 2 ? "selected" : ""}>${window.siyuan.languages.export2}</option>
|
||||
<option value="3" ${window.siyuan.config.export.blockRefMode === 3 ? "selected" : ""}>${window.siyuan.languages.export3}</option>
|
||||
<option value="4" ${window.siyuan.config.export.blockRefMode === 4 ? "selected" : ""}>${window.siyuan.languages.export4}</option>
|
||||
<option value="5" ${window.siyuan.config.export.blockRefMode === 5 ? "selected" : ""}>${window.siyuan.languages.export9}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="fn__flex b3-label config__item">
|
||||
|
|
|
@ -66,6 +66,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/system/exportConf", model.CheckAuth, model.CheckAdminRole, exportConf)
|
||||
ginServer.Handle("POST", "/api/system/importConf", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importConf)
|
||||
ginServer.Handle("POST", "/api/system/getWorkspaceInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getWorkspaceInfo)
|
||||
ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI)
|
||||
|
||||
ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorage)
|
||||
ginServer.Handle("POST", "/api/storage/getLocalStorage", model.CheckAuth, getLocalStorage)
|
||||
|
|
|
@ -35,6 +35,13 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func reloadUI(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
util.ReloadUI()
|
||||
}
|
||||
|
||||
func getWorkspaceInfo(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
@ -22,9 +22,9 @@ type Export struct {
|
|||
// 内容块引用导出模式
|
||||
// 2:锚文本块链
|
||||
// 3:仅锚文本
|
||||
// 4:块引转脚注
|
||||
// 5:锚点哈希 https://github.com/siyuan-note/siyuan/issues/10265
|
||||
// (0:使用原始文本,1:使用 Blockquote。0 和 1 都已经废弃 https://github.com/siyuan-note/siyuan/issues/3155)
|
||||
// 4:块引转脚注+锚点哈希
|
||||
// (5:锚点哈希 https://github.com/siyuan-note/siyuan/issues/10265 已经废弃 https://github.com/siyuan-note/siyuan/issues/13331)
|
||||
// (0:使用原始文本,1:使用 Blockquote,都已经废弃 https://github.com/siyuan-note/siyuan/issues/3155)
|
||||
BlockRefMode int `json:"blockRefMode"`
|
||||
BlockEmbedMode int `json:"blockEmbedMode"` // 内容块引用导出模式,0:使用原始文本,1:使用 Blockquote
|
||||
BlockRefTextLeft string `json:"blockRefTextLeft"` // 内容块引用导出锚文本左侧符号,默认留空
|
||||
|
|
|
@ -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.20241127120230-1ae6a9868a2d
|
||||
github.com/88250/lute v1.7.7-0.20241206153537-408cb4f3fbab
|
||||
github.com/88250/lute v1.7.7-0.20241208103455-3223b6b5f502
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||
github.com/ConradIrwin/font v0.0.0-20240627033111-8567075b2bfe
|
||||
|
|
|
@ -14,8 +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.20241127120230-1ae6a9868a2d h1:dexFyk3UkR4c2xpyrC4Zk4L28xFbfLYAeowIW/7QYEA=
|
||||
github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
||||
github.com/88250/lute v1.7.7-0.20241206153537-408cb4f3fbab h1:TRN5UZIude8Gmks6ODC6bpT6MklMhBCDwjclpsX0YgQ=
|
||||
github.com/88250/lute v1.7.7-0.20241206153537-408cb4f3fbab/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/lute v1.7.7-0.20241208103455-3223b6b5f502 h1:agB9kKKmVrmMa4iSpI7YAN4O3OyV3W+w09CTwgnY7Z8=
|
||||
github.com/88250/lute v1.7.7-0.20241208103455-3223b6b5f502/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
@ -18,6 +18,7 @@ package model
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -266,9 +267,10 @@ func InitConf() {
|
|||
if nil == Conf.Export {
|
||||
Conf.Export = conf.NewExport()
|
||||
}
|
||||
if 0 == Conf.Export.BlockRefMode || 1 == Conf.Export.BlockRefMode {
|
||||
if 0 == Conf.Export.BlockRefMode || 1 == Conf.Export.BlockRefMode || 5 == Conf.Export.BlockRefMode {
|
||||
// 废弃导出选项引用块转换为原始块和引述块 https://github.com/siyuan-note/siyuan/issues/3155
|
||||
Conf.Export.BlockRefMode = 4 // 改为脚注
|
||||
// 锚点哈希模式和脚注模式合并 https://github.com/siyuan-note/siyuan/issues/13331
|
||||
Conf.Export.BlockRefMode = 4 // 改为脚注+锚点哈希
|
||||
}
|
||||
if "" == Conf.Export.PandocBin {
|
||||
Conf.Export.PandocBin = util.PandocBinPath
|
||||
|
@ -391,6 +393,9 @@ func InitConf() {
|
|||
if 1 > Conf.Repo.RetentionIndexesDaily {
|
||||
Conf.Repo.RetentionIndexesDaily = 2
|
||||
}
|
||||
if 0 < len(Conf.Repo.Key) {
|
||||
logging.LogInfof("repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||
}
|
||||
|
||||
if nil == Conf.Search {
|
||||
Conf.Search = conf.NewSearch()
|
||||
|
|
|
@ -566,11 +566,6 @@ func ExportResources(resourcePaths []string, mainName string) (exportFilePath st
|
|||
|
||||
func Preview(id string) (retStdHTML string) {
|
||||
blockRefMode := Conf.Export.BlockRefMode
|
||||
if 5 == blockRefMode {
|
||||
// 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283
|
||||
blockRefMode = 4
|
||||
}
|
||||
|
||||
tree, _ := LoadTreeByBlockID(id)
|
||||
tree = exportTree(tree, false, false, true,
|
||||
blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
|
||||
|
@ -675,13 +670,6 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
|
|||
}
|
||||
|
||||
blockRefMode := Conf.Export.BlockRefMode
|
||||
if docx {
|
||||
if 5 == blockRefMode {
|
||||
// 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283
|
||||
blockRefMode = 4
|
||||
}
|
||||
}
|
||||
|
||||
tree = exportTree(tree, true, false, true,
|
||||
blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
|
||||
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
|
||||
|
@ -839,11 +827,6 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
|
|||
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
h.PrependChild(link)
|
||||
}
|
||||
|
||||
if 5 == blockRefMode {
|
||||
// 如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283
|
||||
blockRefMode = 4
|
||||
}
|
||||
}
|
||||
|
||||
tree = exportTree(tree, true, keepFold, true,
|
||||
|
@ -1445,7 +1428,7 @@ func BatchExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipP
|
|||
}
|
||||
docPaths = util.FilterSelfChildDocs(docPaths)
|
||||
|
||||
zipPath = exportPandocConvertZip(false, box.ID, baseFolderName, docPaths, "gfm+footnotes+hard_line_breaks", pandocTo, ext)
|
||||
zipPath = exportPandocConvertZip(box.ID, baseFolderName, docPaths, "gfm+footnotes+hard_line_breaks", pandocTo, ext)
|
||||
name = util.GetTreeID(block.Path)
|
||||
return
|
||||
}
|
||||
|
@ -1469,7 +1452,7 @@ func ExportPandocConvertZip(id, pandocTo, ext string) (name, zipPath string) {
|
|||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
|
||||
zipPath = exportPandocConvertZip(false, boxID, baseFolderName, docPaths, "gfm+footnotes+hard_line_breaks", pandocTo, ext)
|
||||
zipPath = exportPandocConvertZip(boxID, baseFolderName, docPaths, "gfm+footnotes+hard_line_breaks", pandocTo, ext)
|
||||
name = util.GetTreeID(block.Path)
|
||||
return
|
||||
}
|
||||
|
@ -1497,7 +1480,7 @@ func ExportNotebookMarkdown(boxID, folderPath string) (zipPath string) {
|
|||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
zipPath = exportPandocConvertZip(true, boxID, baseFolderName, docPaths, "", "", ".md")
|
||||
zipPath = exportPandocConvertZip(boxID, baseFolderName, docPaths, "", "", ".md")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2004,7 +1987,7 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
|
|||
}
|
||||
}
|
||||
|
||||
if 5 == blockRefMode { // 锚点哈希
|
||||
if 4 == blockRefMode { // 脚注+锚点哈希
|
||||
if n.IsBlock() && gulu.Str.Contains(n.ID, defBlockIDs) {
|
||||
// 如果是定义块,则在开头处添加锚点
|
||||
anchorSpan := &ast.Node{Type: ast.NodeInlineHTML, Tokens: []byte("<span id=\"" + n.ID + "\"></span>")}
|
||||
|
@ -2082,9 +2065,9 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
depth = 0
|
||||
blockLink2Ref(ret, ret.ID, &treeCache, &depth)
|
||||
|
||||
// 收集引用转脚注
|
||||
// 收集引用转脚注+锚点哈希
|
||||
var refFootnotes []*refAsFootnotes
|
||||
if 4 == blockRefMode { // 块引转脚注
|
||||
if 4 == blockRefMode {
|
||||
depth = 0
|
||||
collectFootnotesDefs(ret, ret.ID, &refFootnotes, &treeCache, &depth)
|
||||
}
|
||||
|
@ -2163,10 +2146,10 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
}
|
||||
n.InsertBefore(blockRefLink)
|
||||
unlinks = append(unlinks, n)
|
||||
case 4: // 脚注
|
||||
case 4: // 脚注+锚点哈希
|
||||
if currentTreeNodeIDs[defID] {
|
||||
// 当前文档内不转换脚注,直接使用锚点哈希 https://github.com/siyuan-note/siyuan/issues/13283
|
||||
n.TextMarkType = "a"
|
||||
n.TextMarkType = strings.ReplaceAll(n.TextMarkType, "block-ref", "a")
|
||||
n.TextMarkTextContent = linkText
|
||||
n.TextMarkAHref = "#" + defID
|
||||
return ast.WalkContinue
|
||||
|
@ -2180,8 +2163,6 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})
|
||||
n.InsertBefore(&ast.Node{Type: ast.NodeFootnotesRef, Tokens: []byte("^" + refFoot.refNum), FootnotesRefId: refFoot.refNum, FootnotesRefLabel: []byte("^" + refFoot.refNum)})
|
||||
unlinks = append(unlinks, n)
|
||||
case 5: // 锚点哈希
|
||||
// 此处不做任何处理
|
||||
}
|
||||
|
||||
if nil != n.Next && ast.NodeKramdownSpanIAL == n.Next.Type {
|
||||
|
@ -2194,7 +2175,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
n.Unlink()
|
||||
}
|
||||
|
||||
if 4 == blockRefMode { // 块引转脚注
|
||||
if 4 == blockRefMode { // 脚注+锚点哈希
|
||||
unlinks = nil
|
||||
footnotesDefBlock := resolveFootnotesDefs(&refFootnotes, ret, currentTreeNodeIDs, blockRefTextLeft, blockRefTextRight, &treeCache)
|
||||
if nil != footnotesDefBlock {
|
||||
|
@ -2243,6 +2224,11 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
title.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(content)})
|
||||
ret.Root.PrependChild(title)
|
||||
}
|
||||
} else {
|
||||
if 4 == blockRefMode { // 脚注+锚点哈希
|
||||
anchorSpan := &ast.Node{Type: ast.NodeInlineHTML, Tokens: []byte("<span id=\"" + id + "\"></span>")}
|
||||
ret.Root.PrependChild(anchorSpan)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出时支持导出题头图 https://github.com/siyuan-note/siyuan/issues/4372
|
||||
|
@ -3064,7 +3050,7 @@ func processFileAnnotationRef(refID string, n *ast.Node, fileAnnotationRefMode i
|
|||
return ast.WalkSkipChildren
|
||||
}
|
||||
|
||||
func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, docPaths []string,
|
||||
func exportPandocConvertZip(boxID, baseFolderName string, docPaths []string,
|
||||
pandocFrom, pandocTo, ext string) (zipPath string) {
|
||||
dir, name := path.Split(baseFolderName)
|
||||
name = util.FilterFileName(name)
|
||||
|
@ -3085,7 +3071,7 @@ func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, d
|
|||
|
||||
exportRefMode := Conf.Export.BlockRefMode
|
||||
var defBlockIDs []string
|
||||
if 5 == exportRefMode {
|
||||
if 4 == exportRefMode { // 脚注+锚点哈希
|
||||
// 导出锚点哈希,这里先记录下所有定义块的 ID
|
||||
walked := map[string]bool{}
|
||||
for _, p := range docPaths {
|
||||
|
@ -3103,19 +3089,26 @@ func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, d
|
|||
continue
|
||||
}
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || !treenode.IsBlockRef(n) {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
defID, _, _ := treenode.GetBlockRef(n)
|
||||
if defBt := treenode.GetBlockTree(defID); nil != defBt {
|
||||
docPaths = append(docPaths, defBt.Path)
|
||||
docPaths = gulu.Str.RemoveDuplicatedElem(docPaths)
|
||||
var defID string
|
||||
if treenode.IsBlockLink(n) {
|
||||
defID = strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")
|
||||
|
||||
defBlockIDs = append(defBlockIDs, defID)
|
||||
defBlockIDs = gulu.Str.RemoveDuplicatedElem(defBlockIDs)
|
||||
} else if treenode.IsBlockRef(n) {
|
||||
defID, _, _ = treenode.GetBlockRef(n)
|
||||
}
|
||||
|
||||
walked[defBt.Path] = true
|
||||
if "" != defID {
|
||||
if defBt := treenode.GetBlockTree(defID); nil != defBt {
|
||||
docPaths = append(docPaths, defBt.Path)
|
||||
docPaths = gulu.Str.RemoveDuplicatedElem(docPaths)
|
||||
defBlockIDs = append(defBlockIDs, defID)
|
||||
defBlockIDs = gulu.Str.RemoveDuplicatedElem(defBlockIDs)
|
||||
walked[defBt.Path] = true
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
|
|
@ -19,6 +19,7 @@ package model
|
|||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"crypto/sha1"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
|
@ -555,6 +556,7 @@ func ImportRepoKey(base64Key string) (retKey string, err error) {
|
|||
|
||||
Conf.Repo.Key = key
|
||||
Conf.Save()
|
||||
logging.LogInfof("imported repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||
|
||||
if err = os.RemoveAll(Conf.Repo.GetSaveDir()); err != nil {
|
||||
return
|
||||
|
@ -669,6 +671,7 @@ func InitRepoKeyFromPassphrase(passphrase string) (err error) {
|
|||
|
||||
Conf.Repo.Key = key
|
||||
Conf.Save()
|
||||
logging.LogInfof("inited repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||
|
||||
initDataRepo()
|
||||
return
|
||||
|
@ -705,6 +708,7 @@ func InitRepoKey() (err error) {
|
|||
}
|
||||
Conf.Repo.Key = key
|
||||
Conf.Save()
|
||||
logging.LogInfof("inited repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||
|
||||
initDataRepo()
|
||||
return
|
||||
|
|
|
@ -1459,8 +1459,7 @@ func fullTextSearchCountByFTS(query, boxFilter, pathFilter, typeFilter, ignoreFi
|
|||
}
|
||||
|
||||
func fullTextSearchByLikeWithRoot(query, boxFilter, pathFilter, typeFilter, ignoreFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
||||
query = strings.ReplaceAll(query, "'", "''")
|
||||
query = strings.ReplaceAll(query, "\"", "\"\"")
|
||||
query = strings.ReplaceAll(query, "'", "''") // 不需要转义双引号,因为条件都是通过单引号包裹的,只需要转义单引号即可
|
||||
keywords := strings.Split(query, " ")
|
||||
contentField := columnConcat()
|
||||
var likeFilter string
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/lex"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func MarkText(text string, keyword string, beforeLen int, caseSensitive bool) (pos int, marked string) {
|
||||
|
@ -112,7 +113,7 @@ func EncloseHighlighting(text string, keywords []string, openMark, closeMark str
|
|||
ret = text
|
||||
|
||||
if reg, err := regexp.Compile(re); err == nil {
|
||||
ret = reg.ReplaceAllStringFunc(text, func(s string) string { return openMark + s + closeMark })
|
||||
ret = reg.ReplaceAllStringFunc(text, func(s string) string { return openMark + util.EscapeHTML(s) + closeMark })
|
||||
}
|
||||
|
||||
// 搜索结果预览包含转义符问题 Search results preview contains escape character issue https://github.com/siyuan-note/siyuan/issues/9790
|
||||
|
|
Loading…
Add table
Reference in a new issue