mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
issues/753
This commit is contained in:
parent
11f370042f
commit
16ea48eb7f
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user