Store to move back to normal tex files
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import os
|
||||
from typing import List
|
||||
import labels
|
||||
import datetime
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
print("""
|
||||
▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄▄ ▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄
|
||||
█ █ █ █ █ █ █▄█ █ █ █ █ █ █ █ █ █ █ ▄ █ █ █
|
||||
█ █ █ ▄ █▄ ▄█ ▄▄▄█ █ █ █▄█ █ ▄▄▄█ █ █ ▄ █ ▄▄▄█ █ █ █ █ ▄▄▄▄▄█
|
||||
█ █ █ █▄█ █ █ █ █ █▄▄▄█ █ █ █ █▄▄▄█ █ █ █▄█ █ █▄▄▄█ █▄▄█▄█ █▄▄▄▄▄
|
||||
█ █▄▄▄█ █ █ █ █ ▄▄▄██ █ █ ▄ █ ▄▄▄█ █▄▄▄█ ▄▄▄█ ▄▄▄█ ▄▄ █▄▄▄▄▄ █
|
||||
█ █ ▄ █ █ █ █ █▄▄▄█ ▄ █ █ █ █ █ █▄▄▄█ █ █ █ █▄▄▄█ █ █ █▄▄▄▄▄█ █
|
||||
█▄▄▄▄▄▄▄█▄█ █▄▄█ █▄▄▄█ █▄▄▄▄▄▄▄█▄▄█ █▄▄█ █▄▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄█ █▄▄▄▄▄▄▄█▄▄▄█ █▄█▄▄▄▄▄▄▄█
|
||||
|
||||
|
||||
""")
|
||||
|
||||
|
||||
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"
|
||||
|
||||
return data
|
||||
|
||||
|
||||
output = load_all_files_of_array("../src/", ["header.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/core/", ["translation.sty"])
|
||||
output += load_all_files_of_array("../src/", ["opts.sty", "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]
|
||||
|
||||
with open("../janishutz-helpers.sty", "w") as file:
|
||||
file.write(output)
|
||||
|
||||
|
||||
print("==> Built successfully. Output to project-root/janishutz-helpers.sty\n")
|
||||
print("==> ")
|
||||
|
||||
61
build/labels.py
Normal file
61
build/labels.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# Auto-generate labels and version numbers
|
||||
def generate_labels():
|
||||
data = ""
|
||||
reset_func = "\\newcommand{\\newsectionNoPB}{"
|
||||
|
||||
for label in [
|
||||
"definition",
|
||||
"example",
|
||||
"theorem",
|
||||
"lemma",
|
||||
"corollary",
|
||||
"proposition",
|
||||
"fact",
|
||||
"formula",
|
||||
"remark",
|
||||
"combine",
|
||||
]:
|
||||
data += f"\\newcounter{{{label}none}}\n"
|
||||
reset_func += f"\n \\setcounter{{{label}none}}{{0}}\n"
|
||||
|
||||
data += f"\\newcounter{{{label}section}}[section]\n"
|
||||
data += f"\\renewcommand{{\\the{label}section}}{{\\thesection.\\arabic{{{label}section}}}}\n"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
reset_func += f" \\setcounter{{{label}paragraph}}{{0}}\n"
|
||||
|
||||
# Generate tcolorboxes
|
||||
if label != "combine":
|
||||
data += f"""\\newtcolorbox{{{label}}}[2][]{{
|
||||
mainboxstyle,
|
||||
colback={label}color!5!white,
|
||||
colframe={label}color!75!black,
|
||||
colbacktitle={label}color!75!black,
|
||||
title={{\\large #2}},
|
||||
overlay={{
|
||||
\\node[overlaystyle,
|
||||
draw={label}color!75!black,
|
||||
fill={label}color!75!black
|
||||
] at (frame.north east)
|
||||
{{
|
||||
\\large \\tr{{\\{label}NamingEN}}{{\\{label}NamingDE}}\\printLabel{{{label}}}
|
||||
}};
|
||||
}}, #1
|
||||
}}\n\n"""
|
||||
# TODO: If needed, add aliases for \short{definition} as e.g \shortdefinition
|
||||
|
||||
reset_func += "\n \\setcounter{table}{0}\n"
|
||||
reset_func += " \\setcounter{figure}{0}\n"
|
||||
reset_func += "}\n"
|
||||
|
||||
return data, reset_func
|
||||
Reference in New Issue
Block a user