2022-02-04 11:39:15 +01:00
|
|
|
from enum import Enum
|
|
|
|
|
2022-02-09 11:49:14 +01:00
|
|
|
from PyTeX.format.macros import MacroReplacementAtomIF
|
|
|
|
|
2022-02-04 11:39:15 +01:00
|
|
|
|
|
|
|
class NamingScheme(Enum):
|
|
|
|
prepend_author = 0
|
|
|
|
clean = 1
|
|
|
|
|
|
|
|
|
2022-02-06 00:12:54 +01:00
|
|
|
class TeXType(Enum):
|
|
|
|
TeXPackage = 'TeXPackage'
|
|
|
|
TeXClass = 'TeXClass'
|
|
|
|
TeXDocstrip = 'TeXDocstrip'
|
|
|
|
TeXDictionary = 'TeXDictionary'
|
|
|
|
TeXDocumentation = 'TeXDocumentation'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def parse(tex_type: str):
|
|
|
|
switcher = {
|
|
|
|
'package': TeXType.TeXPackage,
|
|
|
|
'sty': TeXType.TeXPackage,
|
|
|
|
'class': TeXType.TeXClass,
|
|
|
|
'cls': TeXType.TeXClass,
|
|
|
|
'dictionary': TeXType.TeXDictionary,
|
|
|
|
'dict': TeXType.TeXDictionary,
|
|
|
|
'documentation': TeXType.TeXDocumentation,
|
|
|
|
'doc': TeXType.TeXDocumentation, # TODO: dangerous?
|
|
|
|
'dtx': TeXType.TeXDocstrip,
|
|
|
|
'docstrip': TeXType.TeXDocstrip,
|
|
|
|
'strip': TeXType.TeXDocstrip
|
|
|
|
}
|
|
|
|
if tex_type not in switcher.keys():
|
|
|
|
raise NotImplementedError
|
|
|
|
else:
|
|
|
|
return switcher[tex_type]
|
|
|
|
|
|
|
|
|
|
|
|
class TeXFlavour(Enum):
|
|
|
|
TeX = 'TeX'
|
|
|
|
LaTeX2e = 'LaTeX2e'
|
|
|
|
LaTeX3 = 'LaTeX3'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def parse(flavour: str):
|
|
|
|
switcher = {
|
|
|
|
'1': TeXFlavour.TeX,
|
|
|
|
'2': TeXFlavour.LaTeX2e,
|
|
|
|
'2e': TeXFlavour.LaTeX2e,
|
|
|
|
'3': TeXFlavour.LaTeX3,
|
|
|
|
'TeX': TeXFlavour.TeX,
|
|
|
|
'LaTeX2e': TeXFlavour.LaTeX2e,
|
|
|
|
'LateX3': TeXFlavour.LaTeX3
|
|
|
|
}
|
|
|
|
if flavour not in switcher.keys():
|
|
|
|
raise NotImplementedError
|
|
|
|
else:
|
|
|
|
return switcher[flavour]
|
2022-02-09 11:49:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class FormatterProperty(MacroReplacementAtomIF, Enum):
|
|
|
|
author = 'author'
|
|
|
|
shortauthor = 'shortauthor'
|
|
|
|
date = 'date'
|
|
|
|
year = 'year'
|
|
|
|
version = 'version',
|
|
|
|
source_file_name = 'source_file_name'
|
|
|
|
name = 'name' # class or package name
|
|
|
|
repo_version = 'repo_version'
|
|
|
|
pytex_version = 'pytex_version'
|
|
|
|
|
|
|
|
|
|
|
|
class Argument(MacroReplacementAtomIF, Enum):
|
|
|
|
one = 1
|
|
|
|
two = 2
|
|
|
|
three = 3
|
|
|
|
four = 4
|
|
|
|
five = 5
|
|
|
|
six = 6
|