fix writing config to file

This commit is contained in:
Maximilian Keßler 2022-02-18 21:47:01 +01:00
parent fbb7771dee
commit cdaf38c4d6
2 changed files with 9 additions and 6 deletions

View file

@ -22,7 +22,7 @@ class PyTeXConfig(Config):
self._force_mode: Optional[bool] = None
self._configs: Optional[Dict] = None
self._configs: Optional[Dict[str, FormattingConfig]] = None
def to_json(self) -> Dict:
return {
@ -35,7 +35,10 @@ class PyTeXConfig(Config):
YAML_DIRS: self.build_dir_specification.to_json()
},
YAML_DEFAULT: self.default_formatting_config.to_json(),
YAML_CONFIGS: self._configs
YAML_CONFIGS: {
filename: config.to_json()
for filename, config in self._configs.items()
} if self._configs else None
}
def set_from_json(self, content: Optional[Dict]):

View file

@ -94,10 +94,10 @@ class FormattingConfig(Config):
return {
YAML_INFO: {
YAML_AUTHOR: self._author,
YAML_NAMING_SCHEME: self._naming_scheme,
YAML_TEX_FLAVOUR: self._tex_flavour,
YAML_TEX_TYPE: self._tex_type,
YAML_TEX_OUT_TYPE: self._tex_out_type,
YAML_NAMING_SCHEME: self._naming_scheme.value if self._naming_scheme else None,
YAML_TEX_FLAVOUR: self._tex_flavour.value if self._tex_flavour else None,
YAML_TEX_TYPE: self._tex_type.value if self._tex_type else None,
YAML_TEX_OUT_TYPE: self._tex_out_type.value if self._tex_out_type else None,
YAML_VERSION: self._version,
YAML_DESCRIPTION: self._description
},