Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
40cbf3c8c3
17 changed files with 77 additions and 26 deletions
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "Inline-Formel",
|
||||
"inlineMemo": "Inline-Notiz",
|
||||
"blockRef": "Referenz-Ankertext",
|
||||
"fileAnnotationRef": "PDF-Anmerkungsankertext",
|
||||
"kbd": "Tastatur",
|
||||
"mark": "Markierung",
|
||||
"s": "Durchgestrichen",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "Inline formula",
|
||||
"inlineMemo": "Inline memo",
|
||||
"blockRef": "Ref anchor text",
|
||||
"fileAnnotationRef": "PDF annotation anchor text",
|
||||
"kbd": "Keyboard",
|
||||
"mark": "Mark",
|
||||
"s": "Strikethrough",
|
||||
|
|
|
@ -133,7 +133,8 @@
|
|||
"strong": "negrita",
|
||||
"inlineMath": "Fórmula en línea",
|
||||
"inlineMemo": "Nota en línea",
|
||||
"blockRef": "texto de anclaje de referencia",
|
||||
"blockRef": "Texto de anclaje de referencia",
|
||||
"fileAnnotationRef": "Texto de anclaje de la anotación PDF",
|
||||
"kbd": "Teclado",
|
||||
"mark": "Marca",
|
||||
"s": "Tachado",
|
||||
|
|
|
@ -133,7 +133,8 @@
|
|||
"strong": "Audacieux",
|
||||
"inlineMath": "Formule en ligne",
|
||||
"inlineMemo": "Mémo en ligne",
|
||||
"blockRef": "texte d'ancrage de référence",
|
||||
"blockRef": "Texte d'ancrage de référence",
|
||||
"fileAnnotationRef": "Texte d'ancrage de l'annotation PDF",
|
||||
"kbd": "Clavier",
|
||||
"mark": "Marquer",
|
||||
"s": "Barré",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "מתמטיקה פנימית",
|
||||
"inlineMemo": "הערה פנימית",
|
||||
"blockRef": "טקסט עוגן ייחוס",
|
||||
"fileAnnotationRef": "טקסט עוגן של הערת PDF",
|
||||
"kbd": "מקלדת",
|
||||
"mark": "ציון",
|
||||
"s": "קו מחיקה",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "Formula in linea",
|
||||
"inlineMemo": "Memo in linea",
|
||||
"blockRef": "Testo ancora di riferimento",
|
||||
"fileAnnotationRef": "Testo di ancoraggio dell'annotazione PDF",
|
||||
"kbd": "Tastiera",
|
||||
"mark": "Evidenzia",
|
||||
"s": "Barrato",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "インライン数式",
|
||||
"inlineMemo": "インラインメモ",
|
||||
"blockRef": "アンカーテキストを引用する",
|
||||
"fileAnnotationRef": "PDF 注釈アンカーテキスト",
|
||||
"kbd": "キーボード",
|
||||
"mark": "ハイライト",
|
||||
"s": "取り消し線",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "Formuła w linii",
|
||||
"inlineMemo": "Notatka w linii",
|
||||
"blockRef": "Tekst zakotwiczenia ref",
|
||||
"fileAnnotationRef": "Odnośnik do adnotacji PDF",
|
||||
"kbd": "Klawiatura",
|
||||
"mark": "Zaznacz",
|
||||
"s": "Przekreślenie",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "Встраиваемая формула",
|
||||
"inlineMemo": "Встраиваемая заметка",
|
||||
"blockRef": "Текст анкора ссылки",
|
||||
"fileAnnotationRef": "Анкор текста аннотации PDF",
|
||||
"kbd": "Клавиатура",
|
||||
"mark": "Знак",
|
||||
"s": "Перечеркнуто",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "行級公式",
|
||||
"inlineMemo": "行級備註",
|
||||
"blockRef": "引用錨文本",
|
||||
"fileAnnotationRef": "PDF 標註錨文本",
|
||||
"kbd": "鍵盤",
|
||||
"mark": "高亮",
|
||||
"s": "刪除",
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
"inlineMath": "行级公式",
|
||||
"inlineMemo": "行级备注",
|
||||
"blockRef": "引用锚文本",
|
||||
"fileAnnotationRef": "PDF 标注锚文本",
|
||||
"kbd": "键盘",
|
||||
"mark": "高亮",
|
||||
"s": "删除",
|
||||
|
|
|
@ -622,6 +622,7 @@ export abstract class Constants {
|
|||
"inlineMath": false,
|
||||
"inlineMemo": true,
|
||||
"blockRef": false,
|
||||
"fileAnnotationRef": false,
|
||||
"kbd": true,
|
||||
"mark": true,
|
||||
"s": true,
|
||||
|
|
4
app/src/types/config.d.ts
vendored
4
app/src/types/config.d.ts
vendored
|
@ -2138,6 +2138,10 @@ declare namespace Config {
|
|||
* @default false
|
||||
*/
|
||||
blockRef?: boolean;
|
||||
/**
|
||||
* Replace file annotation refs
|
||||
*/
|
||||
fileAnnotationRef?: boolean;
|
||||
/**
|
||||
* Replace kdb elements
|
||||
* @default true
|
||||
|
|
|
@ -122,7 +122,7 @@ func findReplace(c *gin.Context) {
|
|||
}
|
||||
|
||||
replaceTypes := map[string]bool{}
|
||||
// text, imgText, imgTitle, imgSrc, aText, aTitle, aHref, code, em, strong, inlineMath, inlineMemo, kbd, mark, s, sub, sup, tag, u
|
||||
// text, imgText, imgTitle, imgSrc, aText, aTitle, aHref, code, em, strong, inlineMath, inlineMemo, blockRef, fileAnnotationRef kbd, mark, s, sub, sup, tag, u
|
||||
// docTitle, codeBlock, mathBlock, htmlBlock
|
||||
if nil != arg["replaceTypes"] {
|
||||
replaceTypesArg := arg["replaceTypes"].(map[string]interface{})
|
||||
|
|
|
@ -360,6 +360,25 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
logging.LogErrorf("remove temp storage av dir failed: %s", removeErr)
|
||||
}
|
||||
|
||||
// 清理一些冗余的数据
|
||||
avDir := filepath.Join(util.DataDir, "storage", "av")
|
||||
for _, tree := range trees {
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
ial := parse.IAL2Map(n.KramdownIAL)
|
||||
avIDs := strings.Split(ial[av.NodeAttrNameAvs], ",")
|
||||
for _, avID := range avIDs {
|
||||
if !filelock.IsExist(filepath.Join(avDir, avID+".json")) {
|
||||
n.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
}
|
||||
|
||||
// 写回 .sy
|
||||
for _, tree := range trees {
|
||||
util.PushEndlessProgress(Conf.language(73) + " " + fmt.Sprintf(Conf.language(70), tree.Root.IALAttr("title")))
|
||||
|
|
|
@ -767,6 +767,20 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||
n.TextMarkBlockRefSubtype = "s"
|
||||
}
|
||||
}
|
||||
} else if n.IsTextMarkType("file-annotation-ref") {
|
||||
if !replaceTypes["fileAnnotationRef"] {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if 0 == method {
|
||||
if strings.Contains(n.TextMarkTextContent, keyword) {
|
||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||
}
|
||||
} else if 3 == method {
|
||||
if nil != r && r.MatchString(n.TextMarkTextContent) {
|
||||
n.TextMarkTextContent = r.ReplaceAllString(n.TextMarkTextContent, replacement)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
|
|
|
@ -195,29 +195,31 @@ type CriterionTypes struct {
|
|||
}
|
||||
|
||||
type CriterionReplaceTypes struct {
|
||||
Text bool `json:"text"`
|
||||
ImgText bool `json:"imgText"`
|
||||
ImgTitle bool `json:"imgTitle"`
|
||||
ImgSrc bool `json:"imgSrc"`
|
||||
AText bool `json:"aText"`
|
||||
ATitle bool `json:"aTitle"`
|
||||
AHref bool `json:"aHref"`
|
||||
Code bool `json:"code"`
|
||||
Em bool `json:"em"`
|
||||
Strong bool `json:"strong"`
|
||||
InlineMath bool `json:"inlineMath"`
|
||||
InlineMemo bool `json:"inlineMemo"`
|
||||
Kbd bool `json:"kbd"`
|
||||
Mark bool `json:"mark"`
|
||||
S bool `json:"s"`
|
||||
Sub bool `json:"sub"`
|
||||
Sup bool `json:"sup"`
|
||||
Tag bool `json:"tag"`
|
||||
U bool `json:"u"`
|
||||
DocTitle bool `json:"docTitle"`
|
||||
CodeBlock bool `json:"codeBlock"`
|
||||
MathBlock bool `json:"mathBlock"`
|
||||
HtmlBlock bool `json:"htmlBlock"`
|
||||
Text bool `json:"text"`
|
||||
ImgText bool `json:"imgText"`
|
||||
ImgTitle bool `json:"imgTitle"`
|
||||
ImgSrc bool `json:"imgSrc"`
|
||||
AText bool `json:"aText"`
|
||||
ATitle bool `json:"aTitle"`
|
||||
AHref bool `json:"aHref"`
|
||||
Code bool `json:"code"`
|
||||
Em bool `json:"em"`
|
||||
Strong bool `json:"strong"`
|
||||
InlineMath bool `json:"inlineMath"`
|
||||
InlineMemo bool `json:"inlineMemo"`
|
||||
BlockRef bool `json:"blockRef"`
|
||||
FileAnnotationRef bool `json:"fileAnnotationRef"`
|
||||
Kbd bool `json:"kbd"`
|
||||
Mark bool `json:"mark"`
|
||||
S bool `json:"s"`
|
||||
Sub bool `json:"sub"`
|
||||
Sup bool `json:"sup"`
|
||||
Tag bool `json:"tag"`
|
||||
U bool `json:"u"`
|
||||
DocTitle bool `json:"docTitle"`
|
||||
CodeBlock bool `json:"codeBlock"`
|
||||
MathBlock bool `json:"mathBlock"`
|
||||
HtmlBlock bool `json:"htmlBlock"`
|
||||
}
|
||||
|
||||
var criteriaLock = sync.Mutex{}
|
||||
|
|
Loading…
Add table
Reference in a new issue