From 2f87e4b4c7c77d971c2aa8a81b36386586e395eb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 26 Sep 2023 10:51:25 +0800 Subject: [PATCH] :art: Update av export --- kernel/model/import.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/kernel/model/import.go b/kernel/model/import.go index b7d44305d..383beedbd 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -260,18 +260,13 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { ial := parse.IAL2Map(n.KramdownIAL) for k, v := range ial { if strings.HasPrefix(k, NodeAttrNamePrefixAvKey) || strings.HasPrefix(k, NodeAttrNameAvs) { + newKey, newVal := k, v for oldAvID, newAvID := range avIDs { - newKey := strings.ReplaceAll(k, oldAvID, newAvID) - newVal := strings.ReplaceAll(v, oldAvID, newAvID) - if newKey != k { - n.SetIALAttr(newKey, v) - n.RemoveIALAttr(k) - k = newKey - } - if newVal != v { - n.SetIALAttr(k, newVal) - } + newKey = strings.ReplaceAll(newKey, oldAvID, newAvID) + newVal = strings.ReplaceAll(newVal, oldAvID, newAvID) } + n.RemoveIALAttr(k) + n.SetIALAttr(newKey, newVal) } }