issues/753

This commit is contained in:
恍兮惚兮 2024-05-19 07:39:05 +08:00
parent 11f370042f
commit 16ea48eb7f
2 changed files with 17 additions and 3 deletions

View File

@ -109,7 +109,8 @@ class MAINUI:
context = None
try:
if method["object"].using:
content, context = method["object"].process_before(content)
if 'process_before' in dir(method["object"]):
content, context = method["object"].process_before(content)
except:
print_exc()
contexts.append(context)
@ -121,7 +122,8 @@ class MAINUI:
context = mp[i]
try:
if method["object"].using:
res = method["object"].process_after(res, context)
if 'process_after' in dir(method["object"]):
res = method["object"].process_after(res, context)
except:
print_exc()
return res

View File

@ -525,7 +525,19 @@ def parsemayberegexreplace(dict, res):
res,
)
else:
res = res.replace(item["key"], item["value"])
if (
res.isascii()
and item["key"].isascii()
and item["value"].isascii()
and (" " not in item["key"])
): # 目标可能有空格
resx = res.split(" ")
for i in range(len(resx)):
if resx[i] == item["key"]:
resx[i] = item["value"]
res = " ".join(resx)
else:
res = res.replace(item["key"], item["value"])
return res