Files
latex/build/build.py
Janis Hutz baebaa99d0
Some checks failed
Update docs / build_docs (push) Has been cancelled
Update helpers / build_helpers (push) Successful in 25s
Update docs (mostly), fixes, etc
2026-02-21 16:24:21 +01:00

62 lines
2.8 KiB
Python

import os
from typing import List
import labels
import datetime
import sys
version = "1.0.1"
print("""
▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄▄ ▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄
█ █ █ █ █ █ █▄█ █ █ █ █ █ █ █ █ █ █ ▄ █ █ █
█ █ █ ▄ █▄ ▄█ ▄▄▄█ █ █ █▄█ █ ▄▄▄█ █ █ ▄ █ ▄▄▄█ █ █ █ █ ▄▄▄▄▄█
█ █ █ █▄█ █ █ █ █ █▄▄▄█ █ █ █ █▄▄▄█ █ █ █▄█ █ █▄▄▄█ █▄▄█▄█ █▄▄▄▄▄
█ █▄▄▄█ █ █ █ █ ▄▄▄██ █ █ ▄ █ ▄▄▄█ █▄▄▄█ ▄▄▄█ ▄▄▄█ ▄▄ █▄▄▄▄▄ █
█ █ ▄ █ █ █ █ █▄▄▄█ ▄ █ █ █ █ █ █▄▄▄█ █ █ █ █▄▄▄█ █ █ █▄▄▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █▄▄█ █▄▄▄█ █▄▄▄▄▄▄▄█▄▄█ █▄▄█ █▄▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄█ █▄▄▄▄▄▄▄█▄▄▄█ █▄█▄▄▄▄▄▄▄█
""")
build_sty = False
try:
build_sty = sys.argv.index("sty") > -1
except:
pass
def load_all_files_of_array(dirname: str, files: List[str]):
data = ""
for filename in files:
with open(dirname + "/" + filename, "r") as file:
data += (file.read() + "\n\n").replace( 'RequirePackage', 'usepackage' )
return data
output = load_all_files_of_array("../src/", ["header.sty"])
if build_sty:
output += f"\\ProvidesPackage{{janishutz-helpers}}[{datetime.datetime.now().date().isoformat()} v{version}]\n\n"
output += load_all_files_of_array("../src/", ["core.sty"])
output += load_all_files_of_array("../config/", os.listdir("../config/"))
l = labels.generate_labels()
output += l[0] + "\n\n"
output += l[1]
output += load_all_files_of_array("../src/", ["style.sty"])
output += load_all_files_of_array("../src/core/", os.listdir("../src/core/"))
output += load_all_files_of_array("../src/counters/", os.listdir("../src/counters/"))
output += load_all_files_of_array("../src/style/", os.listdir("../src/style/"))
output += "\\endinput"
if not build_sty:
with open("../janishutz-helpers.tex", "w") as file:
file.write(output)
else:
with open("../janishutz-helpers.sty", "w") as file:
file.write(output)
print("==> Built successfully. Output to project-root/janishutz-helpers.tex\n")