2-adm-website #4
2 changed files with 21 additions and 5 deletions
10
README.md
10
README.md
|
|
@ -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/).
|
Firstly, you need to install [Hugo](https://gohugo.io/getting-started/installing/).
|
||||||
Next, once you have cloned the repo, you need to:
|
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:
|
Use this command to compile the wiki into hugo format:
|
||||||
> Note: Do not push any changes on the adm-wiki submodule
|
> Note: Do not push any changes on the adm-wiki submodule
|
||||||
```bash
|
```bash
|
||||||
python3 format_wiki.py
|
python3 format_wiki.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Compile the Website
|
## 3. Compile the Website
|
||||||
```bash
|
```bash
|
||||||
hugo
|
hugo
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,21 @@ for file in os.listdir(absWikiPath):
|
||||||
absFilePath = os.path.join(absWikiPath, file)
|
absFilePath = os.path.join(absWikiPath, file)
|
||||||
# Check if the file already contains the header
|
# Check if the file already contains the header
|
||||||
with open(absFilePath) as f:
|
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:
|
if first_line.find("---") != -1:
|
||||||
print(file, "already have header")
|
print(file, "already has been formatted. Skipping...")
|
||||||
continue
|
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)
|
header = get_header_from_file(absFilePath)
|
||||||
line_prepender(os.path.join(absWikiPath, file), header)
|
line_prepender(endpath, header)
|
||||||
print('Added header to', file)
|
print('Added header to', file)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue