fix some bugs related to macros

This commit is contained in:
Maximilian Keßler 2022-02-17 21:39:01 +01:00
parent b0077a3ee9
commit f2ba97cabe
3 changed files with 8 additions and 7 deletions

View file

@ -72,12 +72,12 @@ class PyTeXSourceFile:
def format(self, target_root: Union[Path, RelativePath]) -> List[Tuple[RelativePath, FormattingConfig]]: def format(self, target_root: Union[Path, RelativePath]) -> List[Tuple[RelativePath, FormattingConfig]]:
if self._formatter is None: if self._formatter is None:
raise NotImplementedError # TODO raise NotImplementedError # TODO
try: # try:
configs = self._formatter.format( configs = self._formatter.format(
target_root.path if isinstance(target_root, RelativePath) else target_root target_root.path if isinstance(target_root, RelativePath) else target_root
) )
except Exception as e: # except Exception as e:
raise NotImplementedError # raise NotImplementedError
rel_configs = [ rel_configs = [
(self._relative_path.with_name(filename), config) (self._relative_path.with_name(filename), config)
for [filename, config] in configs for [filename, config] in configs

View file

@ -31,7 +31,7 @@ def get_default_macros(tex_flavour: TeXFlavour):
ConfigEndMacro(), ConfigEndMacro(),
ConfigBeginMacro(), ConfigBeginMacro(),
MacroCodeBeginMacro(), MacroCodeBeginMacro(),
MacroCodeBeginMacro(), MacroCodeEndMacro(),
] ]
tex2 = [ tex2 = [
ArgumentMacro( ArgumentMacro(

View file

@ -12,6 +12,7 @@ class DTXFormatter(TexFormatter):
def dependencies(self) -> List[str]: def dependencies(self) -> List[str]:
return [] # TODO return [] # TODO
@property
def future_config(self) -> List[Tuple[str, FormattingConfig]]: def future_config(self) -> List[Tuple[str, FormattingConfig]]:
return [] # TODO return [] # TODO