2-adm-website #4

Merged
samu merged 2 commits from 2-adm-website into main 2024-04-21 20:17:24 +00:00
2 changed files with 21 additions and 5 deletions

View file

@ -5,14 +5,20 @@ To contribute to the website, you can edit the markdown files in the `content` d
Firstly, you need to install [Hugo](https://gohugo.io/getting-started/installing/).
Next, once you have cloned the repo, you need to:
## 1. Format the Wiki
## 1. Install submodules
```bash
git submodule init && git submodule update
```
## 2. Format the Wiki
Use this command to compile the wiki into hugo format:
> Note: Do not push any changes on the adm-wiki submodule
```bash
python3 format_wiki.py
```
## 2. Compile the Website
## 3. Compile the Website
```bash
hugo
```

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)