adapt usage of macros to new attribute dict
This commit is contained in:
parent
5c244f2680
commit
b4526f5d0c
3 changed files with 15 additions and 1 deletions
|
@ -74,6 +74,7 @@ class FormatterProperty(MacroReplacementAtomIF, Enum):
|
||||||
year = 'year'
|
year = 'year'
|
||||||
raw_name = 'raw_name' # The 'raw' name of the package, without author prefix
|
raw_name = 'raw_name' # The 'raw' name of the package, without author prefix
|
||||||
name = 'name' # class or package name
|
name = 'name' # class or package name
|
||||||
|
file_prefix = 'file_prefix'
|
||||||
version = 'version'
|
version = 'version'
|
||||||
file_name = 'file_name'
|
file_name = 'file_name'
|
||||||
source_file_name = 'source_file_name'
|
source_file_name = 'source_file_name'
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MacroReplacement:
|
||||||
for arg in self.args:
|
for arg in self.args:
|
||||||
if type(arg) == FormatterProperty:
|
if type(arg) == FormatterProperty:
|
||||||
try:
|
try:
|
||||||
new_args.append(getattr(formatter, arg.value))
|
new_args.append(formatter.attribute_dict[arg.value])
|
||||||
except:
|
except:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
elif type(arg) == Argument:
|
elif type(arg) == Argument:
|
||||||
|
|
|
@ -151,6 +151,7 @@ class PyTeXFormatter(FormatterIF, ABC):
|
||||||
FormatterProperty.pytex_dirty.value: self.git_version_info.pytex_version.dirty,
|
FormatterProperty.pytex_dirty.value: self.git_version_info.pytex_version.dirty,
|
||||||
FormatterProperty.tex_type.value: str(self.config.tex_type),
|
FormatterProperty.tex_type.value: str(self.config.tex_type),
|
||||||
FormatterProperty.tex_flavour.value: str(self.config.tex_flavour),
|
FormatterProperty.tex_flavour.value: str(self.config.tex_flavour),
|
||||||
|
FormatterProperty.file_prefix.value: str(self.file_prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -175,6 +176,18 @@ class PyTeXFormatter(FormatterIF, ABC):
|
||||||
else:
|
else:
|
||||||
return parts[0]
|
return parts[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def file_prefix(self) -> str:
|
||||||
|
if self.config.naming_scheme == NamingScheme.prepend_author:
|
||||||
|
if self.config.tex_flavour == TeXFlavour.LaTeX2e:
|
||||||
|
return self.shortauthor + '@' + self.raw_name
|
||||||
|
elif self.config.tex_flavour == TeXFlavour.LaTeX3:
|
||||||
|
return self.shortauthor + '_' + self.raw_name
|
||||||
|
else:
|
||||||
|
raise NotImplementedError
|
||||||
|
else:
|
||||||
|
return self.raw_name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
if self.config.naming_scheme == NamingScheme.prepend_author:
|
if self.config.naming_scheme == NamingScheme.prepend_author:
|
||||||
|
|
Loading…
Reference in a new issue