21 lines
590 B
Python
21 lines
590 B
Python
|
from pathlib import Path
|
||
|
|
||
|
clear = '\033[0m'
|
||
|
colors = {
|
||
|
'red': '\033[31m',
|
||
|
'green': '\033[32m',
|
||
|
'yellow': '\033[33m',
|
||
|
'blue': '\033[34m',
|
||
|
'purple': '\033[35m',
|
||
|
'cyan': '\033[36m',
|
||
|
}
|
||
|
|
||
|
def printc(text, color='blue'):
|
||
|
print(f'{colors[color]}{text}{clear}')
|
||
|
|
||
|
def printerr(text):
|
||
|
print(f'\033[31;5m[ERROR] {text}{clear}')
|
||
|
|
||
|
def replaceContent(content, template, replaceF = lambda temp, cont: temp.replace("%CONTENT", cont)):
|
||
|
with open(str(Path(__file__).parent.absolute()) + f'/tex_templates/{template}.tex') as template:
|
||
|
return replaceF(template.read(), content)
|