2022-07-14 11:46:16 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
INPUT = "readme.md"
|
|
|
|
OUTPUT = "todo_over_the_break.md"
|
|
|
|
URL = "https://gitea.86thumbs.net/waldek/linux_introduction/src/branch/master/"
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
with open(INPUT, "r") as fp:
|
2022-07-14 11:54:58 +02:00
|
|
|
src = []
|
2022-07-14 11:46:16 +02:00
|
|
|
for line in fp.readlines():
|
2022-07-14 11:54:58 +02:00
|
|
|
src.append(line)
|
|
|
|
data = []
|
|
|
|
for nr, line in zip(range(0, len(src)), src):
|
2022-07-14 11:46:16 +02:00
|
|
|
stripped = line.strip()
|
|
|
|
stripped = stripped.replace("*", "")
|
|
|
|
stripped = stripped.strip()
|
2022-07-14 11:54:58 +02:00
|
|
|
if "====" in line:
|
|
|
|
data.append("# {}".format(src[nr - 1]))
|
2022-07-14 11:46:16 +02:00
|
|
|
if "(./" in stripped:
|
|
|
|
topic = stripped[stripped.find("[")+1:stripped.find("]")]
|
|
|
|
url = stripped.replace("(./", "({}".format(URL))
|
|
|
|
url = re.sub("\[.*\]", "[Link]", url)
|
|
|
|
url = " * {} to course documentation".format(url)
|
2022-07-14 11:54:58 +02:00
|
|
|
header = "## {}".format(topic)
|
|
|
|
notes = "### Student notes:"
|
2022-07-14 11:46:16 +02:00
|
|
|
|
|
|
|
data.append(header)
|
|
|
|
data.append(url)
|
|
|
|
data.append(notes)
|
|
|
|
data.append("TODO")
|
|
|
|
|
|
|
|
with open(OUTPUT, "w") as fp:
|
|
|
|
for line in data:
|
|
|
|
fp.write("{}\n\n".format(line))
|