Get working

This commit is contained in:
2026-02-19 19:49:59 +01:00
parent b7b365dd36
commit 35bd979c98
10 changed files with 500 additions and 515 deletions

View File

@@ -29,7 +29,7 @@ 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"
data += (file.read() + "\n\n").replace( 'RequirePackage', 'usepackage' )
return data
@@ -39,13 +39,12 @@ 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("../src/config/", os.listdir("../src/config/"))
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/style/", os.listdir("../src/style/"))
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/style/", os.listdir("../src/style/"))
output += "\\endinput"

View File

@@ -23,15 +23,15 @@ def generate_labels():
reset_func += f" \\setcounter{{{label}section}}{{0}}\n"
data += f"\\newcounter{{{label}subsection}}[subsection]\n"
data += f"\\renewcommand{{\\the{label}subsection}}{{\\thesection.\\thesubsection.\\arabic{{{label}subsection}}}}\n"
data += f"\\renewcommand{{\\the{label}subsection}}{{\\thesubsection.\\arabic{{{label}subsection}}}}\n"
reset_func += f" \\setcounter{{{label}subsection}}{{0}}\n"
data += f"\\newcounter{{{label}subsubsection}}[subsubsection]\n"
data += f"\\renewcommand{{\\the{label}subsubsection}}{{\\thesection.\\thesubsection.\\thesubsubsection.\\arabic{{{label}subsubsection}}}}\n"
data += f"\\renewcommand{{\\the{label}subsubsection}}{{\\thesubsubsection.\\arabic{{{label}subsubsection}}}}\n"
reset_func += f" \\setcounter{{{label}subsubsection}}{{0}}\n"
data += f"\\newcounter{{{label}paragraph}}[paragraph]\n"
data += f"\\renewcommand{{\\the{label}paragraph}}{{\\thesection.\\thesubsection.\\thesubsubsection.\\theparagraph.\\arabic{{{label}paragraph}}}}\n"
data += f"\\renewcommand{{\\the{label}paragraph}}{{\\theparagraph.\\arabic{{{label}paragraph}}}}\n"
reset_func += f" \\setcounter{{{label}paragraph}}{{0}}\n"
# Generate tcolorboxes
@@ -52,7 +52,8 @@ def generate_labels():
}};
}}, #1
}}\n\n"""
# TODO: If needed, add aliases for \short{definition} as e.g \shortdefinition
data += f"\\newcommand{{\\inline{label}}}[1][NONAME]{{\\inline[#1]{{{label}}}}}"
data += f"\\newcommand{{\\short{label}}}[1][NONAME]{{\\short[#1]{{{label}}}}}"
reset_func += "\n \\setcounter{table}{0}\n"
reset_func += " \\setcounter{figure}{0}\n"