26 lines
600 B
Python
26 lines
600 B
Python
|
from typing import List, Union
|
||
|
from enum import Enum
|
||
|
|
||
|
|
||
|
class MacroReplacement(Enum):
|
||
|
author = 'author'
|
||
|
shortauthor = 'shortauthor'
|
||
|
date = 'date'
|
||
|
year = 'year'
|
||
|
version = 'version',
|
||
|
file_name = 'file_name'
|
||
|
name = 'name' # class or package name
|
||
|
repo_version = 'repo_version'
|
||
|
pytex_version = 'pytex_version'
|
||
|
|
||
|
|
||
|
class Macro:
|
||
|
def __init__(self):
|
||
|
raise NotImplementedError
|
||
|
|
||
|
def matches(self, line: str) -> bool:
|
||
|
raise NotImplementedError
|
||
|
|
||
|
def apply(self, line: str, *args, **kwargs) -> Union[str, List[str]]:
|
||
|
raise NotImplementedError
|