22 lines
708 B
Python
22 lines
708 B
Python
# Read the original mkdocs.yml content
|
|
with open('mkdocs.yml', 'r') as file:
|
|
lines = file.readlines()
|
|
|
|
# Find the start and end indexes of the section to replace
|
|
start_index = None
|
|
end_index = None
|
|
for i, line in enumerate(lines):
|
|
if line.strip() == '- Portainer Stacks:':
|
|
start_index = i
|
|
elif line.strip() == '- Swag:':
|
|
end_index = i
|
|
break
|
|
|
|
# Replace the lines between start and end indexes with the new content
|
|
if start_index is not None and end_index is not None:
|
|
lines[start_index:end_index + 1] = [' - Portainer Stacks:\n', ' - Swag:\n']
|
|
|
|
# Write the modified content back to the mkdocs.yml file
|
|
with open('mkdocs.yml', 'w') as file:
|
|
file.writelines(lines)
|