🎨 Export block ref Anchor hash
supports doc-level https://github.com/siyuan-note/siyuan/issues/11814
This commit is contained in:
parent
d76b05536a
commit
335d390d20
7 changed files with 23 additions and 17 deletions
|
@ -1078,7 +1078,7 @@
|
|||
"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 (only for exporting Notebook)",
|
||||
"export9": "Anchor hash",
|
||||
"graphConfig2": "Reference Count filter",
|
||||
"selectOpen": "Always Select Opened Doc",
|
||||
"selectOpen1": "Select Opened Doc",
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
"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 (sólo para exportar Notebook)",
|
||||
"export9": "Hash de anclaje",
|
||||
"graphConfig2": "Filtro de recuento de referencias",
|
||||
"selectOpen": "Seleccionar siempre el documento abierto",
|
||||
"selectOpen1": "Seleccionar documento abierto",
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
"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 (uniquement pour l'exportation de Notebook)",
|
||||
"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",
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
"export6": "エクスポート時の PDF 注釈内のアンカーテキストの処理方法",
|
||||
"export7": "ファイル名 - ページ番号 - アンカーテキスト",
|
||||
"export8": "アンカーテキストのみ",
|
||||
"export9": "アンカーハッシュ (ノートブックのエクスポート専用)",
|
||||
"export9": "アンカーハッシュ",
|
||||
"graphConfig2": "参照カウントフィルタ",
|
||||
"selectOpen": "常に開いているドキュメントを選択",
|
||||
"selectOpen1": "開いているドキュメントをツリーで選択",
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
"export6": "導出時關於 PDF 標註引出處錨文字的處理方式",
|
||||
"export7": "文件名 - 頁碼 - 錨文字",
|
||||
"export8": "僅錨文字",
|
||||
"export9": "錨點哈希(僅支援導出筆記本)",
|
||||
"export9": "錨點哈希",
|
||||
"graphConfig2": "引用塊次數過濾",
|
||||
"selectOpen": "定位打開的文檔",
|
||||
"selectOpen1": "定位打開的文檔",
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
"export6": "导出时关于 PDF 标注引出处锚文本的处理方式",
|
||||
"export7": "文件名 - 页码 - 锚文本",
|
||||
"export8": "仅锚文本",
|
||||
"export9": "锚点哈希(仅支持导出笔记本)",
|
||||
"export9": "锚点哈希",
|
||||
"graphConfig2": "引用块次数过滤",
|
||||
"selectOpen": "始终定位打开的文档",
|
||||
"selectOpen1": "定位打开的文档",
|
||||
|
|
|
@ -2618,16 +2618,15 @@ func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, d
|
|||
}
|
||||
|
||||
exportRefMode := Conf.Export.BlockRefMode
|
||||
if !exportNotebook && 5 == exportRefMode {
|
||||
// 非笔记本导出不支持锚点哈希,将其切换为锚文本块链
|
||||
exportRefMode = 2
|
||||
}
|
||||
|
||||
var defBlockIDs []string
|
||||
if exportNotebook && 5 == exportRefMode {
|
||||
// Add a Ref export mode `Anchor hash` for notebook Markdown exporting https://github.com/siyuan-note/siyuan/issues/10265
|
||||
// 导出笔记本时导出锚点哈希,这里先记录下所有定义块的 ID
|
||||
if 5 == exportRefMode {
|
||||
// 导出锚点哈希,这里先记录下所有定义块的 ID
|
||||
walked := map[string]bool{}
|
||||
for _, p := range docPaths {
|
||||
if walked[p] {
|
||||
continue
|
||||
}
|
||||
|
||||
docIAL := box.docIAL(p)
|
||||
if nil == docIAL {
|
||||
continue
|
||||
|
@ -2638,18 +2637,25 @@ func exportPandocConvertZip(exportNotebook bool, boxID, baseFolderName string, d
|
|||
continue
|
||||
}
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
if !entering || !treenode.IsBlockRef(n) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if treenode.IsBlockRef(n) {
|
||||
defID, _, _ := treenode.GetBlockRef(n)
|
||||
defID, _, _ := treenode.GetBlockRef(n)
|
||||
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
|
||||
})
|
||||
}
|
||||
defBlockIDs = gulu.Str.RemoveDuplicatedElem(defBlockIDs)
|
||||
docPaths = gulu.Str.RemoveDuplicatedElem(docPaths)
|
||||
}
|
||||
|
||||
luteEngine := util.NewLute()
|
||||
|
|
Loading…
Add table
Reference in a new issue