add class formatter. fix typo in error message

This commit is contained in:
Maximilian Keßler 2021-10-08 16:34:52 +02:00
parent 9df6bd0513
commit 6c0dee2511
2 changed files with 12 additions and 1 deletions

11
class_formatter.py Normal file
View file

@ -0,0 +1,11 @@
from formatter import Formatter
from config import DEFAULT_AUTHOR
from replacements import make_default_commands
class ClassFormatter(Formatter):
def __init__(self, class_name: str, author: str = DEFAULT_AUTHOR, extra_header: str = ''):
Formatter.__init__(self, class_name, author, extra_header, '.cls')
def make_default_macros(self):
make_default_commands(self, 'class')

View file

@ -52,7 +52,7 @@ def make_default_commands(formatter: Formatter, latex_file_type: str):
info=Args.one, Type=latex_file_type.capitalize()) info=Args.one, Type=latex_file_type.capitalize())
formatter.add_arg_replacement(1, 'warning', r'\{Type}Warning{{{name}}}{{{warning}}}', formatter.add_arg_replacement(1, 'warning', r'\{Type}Warning{{{name}}}{{{warning}}}',
name=Attributes.name_lowercase, warning=Args.one, Type=latex_file_type.capitalize()) name=Attributes.name_lowercase, warning=Args.one, Type=latex_file_type.capitalize())
formatter.add_arg_replacement(1, 'error', r'\{Type}Error{{{name}}}{{{error}}}}', formatter.add_arg_replacement(1, 'error', r'\{Type}Error{{{name}}}{{{error}}}',
name=Attributes.name_lowercase, error=Args.one, Type=latex_file_type.capitalize()) name=Attributes.name_lowercase, error=Args.one, Type=latex_file_type.capitalize())
formatter.add_replacement('end options x', formatter.add_replacement('end options x',
r"\DeclareOptionX*{{\{Type}Warning{{{name_lowercase}}}" r"\DeclareOptionX*{{\{Type}Warning{{{name_lowercase}}}"