manual update links collections
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
# Get a list of all files in the current directory
|
||||
files = []
|
||||
for root, dirs, filenames in os.walk('.'):
|
||||
for filename in filenames:
|
||||
files.append(os.path.join(root, filename))
|
||||
# Loop through each file
|
||||
for file in files:
|
||||
# Check if the file is a markdown file (.md)
|
||||
if file.endswith('.md'):
|
||||
with open(file, 'r') as f:
|
||||
content = f.read()
|
||||
# Find all strings that start with ]( and end with.md
|
||||
matches = re.findall(r'\]\(([^)]+)\.md\)', content)
|
||||
# Loop through each match
|
||||
new_content = content
|
||||
for match in matches:
|
||||
# If the match contains at least one /, remove everything before the last /
|
||||
if '/' in match:
|
||||
new_match = match.split('/')[-1]
|
||||
new_content = new_content.replace(match, new_match)
|
||||
with open(file, 'w') as f:
|
||||
f.write(new_content)
|
Reference in New Issue
Block a user