@@ -554,25 +554,41 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
554
554
}
555
555
556
556
reloadTreeIDs = append (reloadTreeIDs , tree .ID )
557
-
558
557
if ast .NodeDocument == node .Type {
559
558
if ! replaceTypes ["docTitle" ] {
560
559
continue
561
560
}
562
561
563
562
title := node .IALAttr ("title" )
563
+ tags := node .IALAttr ("tags" )
564
564
if 0 == method {
565
565
if strings .Contains (title , keyword ) {
566
- docTitleReplacement := strings .ReplaceAll (replacement , "/" , "" )
566
+ docTitleReplacement := strings .ReplaceAll (replacement , "/" , "/ " )
567
567
renameRootTitles [node .ID ] = strings .ReplaceAll (title , keyword , docTitleReplacement )
568
568
renameRoots = append (renameRoots , node )
569
569
}
570
+
571
+ if strings .Contains (tags , keyword ) {
572
+ replacement = strings .TrimPrefix (replacement , "#" )
573
+ replacement = strings .TrimSuffix (replacement , "#" )
574
+ tags = strings .ReplaceAll (tags , keyword , replacement )
575
+ node .SetIALAttr ("tags" , tags )
576
+ ReloadTag ()
577
+ }
570
578
} else if 3 == method {
571
579
if nil != r && r .MatchString (title ) {
572
- docTitleReplacement := strings .ReplaceAll (replacement , "/" , "" )
580
+ docTitleReplacement := strings .ReplaceAll (replacement , "/" , "/ " )
573
581
renameRootTitles [node .ID ] = r .ReplaceAllString (title , docTitleReplacement )
574
582
renameRoots = append (renameRoots , node )
575
583
}
584
+
585
+ if nil != r && r .MatchString (tags ) {
586
+ replacement = strings .TrimPrefix (replacement , "#" )
587
+ replacement = strings .TrimSuffix (replacement , "#" )
588
+ tags = r .ReplaceAllString (tags , replacement )
589
+ node .SetIALAttr ("tags" , tags )
590
+ ReloadTag ()
591
+ }
576
592
}
577
593
} else {
578
594
var unlinks []* ast.Node
@@ -905,14 +921,12 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
905
921
for _ , unlink := range unlinks {
906
922
unlink .Unlink ()
907
923
}
908
-
909
- if err = writeTreeUpsertQueue (tree ); err != nil {
910
- return
911
- }
912
924
}
913
925
926
+ if err = writeTreeUpsertQueue (tree ); err != nil {
927
+ return
928
+ }
914
929
updateNodes [id ] = node
915
-
916
930
util .PushEndlessProgress (fmt .Sprintf (Conf .Language (206 ), i + 1 , len (ids )))
917
931
}
918
932
0 commit comments