mirror of
https://github.com/Vonng/ddia.git
synced 2024-12-06 15:20:12 +08:00
support to run zh-tw.py on Windows, improve the handling of newline and image URLs for zh-tw version
This commit is contained in:
parent
ec2fb2676e
commit
782919eb26
@ -3,8 +3,8 @@ import os, sys, opencc
|
||||
|
||||
def convert(src_path, dst_path, cfg='s2twp.json'):
|
||||
converter = opencc.OpenCC(cfg)
|
||||
with open(src_path, "r") as src, open(dst_path, "w+") as dst:
|
||||
dst.write("\n".join(converter.convert(line) for line in src))
|
||||
with open(src_path, "r", encoding='utf-8') as src, open(dst_path, "w+", encoding='utf-8') as dst:
|
||||
dst.write("\n".join(converter.convert(line.rstrip()).replace('(img/', '(../img/') for line in src))
|
||||
print("convert %s to %s" % (src_path, dst_path))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user