mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-18 22:08:13 +00:00
update doc
This commit is contained in:
@@ -13,24 +13,24 @@ def get_files(files, path):
|
||||
elif path.endswith(".md"):
|
||||
files.append(path)
|
||||
|
||||
def fix_path(doc_root_path):
|
||||
files = []
|
||||
get_files(files, doc_root_path)
|
||||
file_map = {}
|
||||
for file in files:
|
||||
name = file.split("/")[-1]
|
||||
file_map[name] = "/" + file
|
||||
|
||||
test_str = read_file("docs/zh/API_Reference/core/attention.md")
|
||||
files = []
|
||||
get_files(files, "docs/zh")
|
||||
file_map = {}
|
||||
for file in files:
|
||||
name = file.split("/")[-1]
|
||||
file_map[name] = "/" + file
|
||||
pattern = re.compile(r'\]\([^)]*\.md')
|
||||
for file in files:
|
||||
context = read_file(file)
|
||||
matches = pattern.findall(context)
|
||||
|
||||
for match in matches:
|
||||
target = "](" + file_map[match.split("/")[-1].replace("](", "")]
|
||||
context = context.replace(match, target)
|
||||
print(match, target)
|
||||
|
||||
with open(file, "w", encoding="utf-8") as f:
|
||||
f.write(context)
|
||||
|
||||
pattern = re.compile(r'\]\([^)]*\.md')
|
||||
for file in files:
|
||||
context = read_file(file)
|
||||
matches = pattern.findall(context)
|
||||
|
||||
for match in matches:
|
||||
target = "](" + file_map[match.split("/")[-1].replace("](", "")]
|
||||
context = context.replace(match, target)
|
||||
print(match, target)
|
||||
|
||||
with open(file, "w", encoding="utf-8") as f:
|
||||
f.write(context)
|
||||
|
||||
Reference in New Issue
Block a user