Weekend 22, some QoL improvements (added wiki_to_prefs_table.py, print wiki header in output as well)

This commit is contained in:
2026-02-01 15:16:59 +01:00
parent d329748b89
commit 467bdbd56f
4 changed files with 97 additions and 65 deletions

31
wiki_to_prefs_table.py Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python
import sys
def process_line(line):
line = line.rstrip(" \n")
if line == "|-":
return
if not line.startswith("|"):
return
line = line.lstrip("| ")
line = line.replace("[[", "")
line = line.replace("]]", "")
line = line.replace("User:", "")
splitted = [x.strip() for x in line.split("||")]
if len(splitted[0].split("|")) == 2:
splitted[0] = splitted[0].split("|")[1]
if splitted[1] == "":
splitted[1] = "-"
if splitted[2] == "":
splitted[2] = "-"
print(f"{splitted[0]}\t{splitted[1]}\t{splitted[2]}")
def main():
for line in sys.stdin:
process_line(line)
if __name__ == "__main__":
main()