2-adm-website #4

Merged
samu merged 2 commits from 2-adm-website into main 2024-04-21 20:17:24 +00:00
Showing only changes of commit 11c7c6778f - Show all commits

View file

@ -67,11 +67,21 @@ for file in os.listdir(absWikiPath):
absFilePath = os.path.join(absWikiPath, file)
# Check if the file already contains the header
with open(absFilePath) as f:
first_line = f.readline()
content = f.read()
all_lines = content.splitlines()
first_line = all_lines[0]
if first_line.find("---") != -1:
print(file, "already have header")
print(file, "already has been formatted. Skipping...")
continue
for i, line in enumerate(all_lines):
if line.startswith("#"):
all_lines[i] = "#" + line
endpath = os.path.join(absWikiPath, file)
with open(endpath, 'w') as f:
f.write("\n".join(all_lines))
header = get_header_from_file(absFilePath)
line_prepender(os.path.join(absWikiPath, file), header)
line_prepender(endpath, header)
print('Added header to', file)