diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-12-14 22:35:33 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-12-14 22:35:33 -0600 |
commit | 6ec12d94c1b25883e3588afcadd686d3dc157675 (patch) | |
tree | 220cc76815d14f43ede36c53b5e253dd5a6e83e5 /src | |
parent | 8461a3b8d48bc772ef449e37e5c98ffc254930fe (diff) |
add more files, fixed bugs related to multiple documents in yaml configv0.8.1
Diffstat (limited to 'src')
-rw-r--r-- | src/pyssg/configuration.py | 11 | ||||
-rw-r--r-- | src/pyssg/page.py | 18 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/pyssg/configuration.py b/src/pyssg/configuration.py index d7c32ae..b68930c 100644 --- a/src/pyssg/configuration.py +++ b/src/pyssg/configuration.py @@ -51,13 +51,14 @@ def __expand_all_paths(config: dict) -> None: # not necessary to type deeper than the first dict def get_parsed_config(path: str) -> list[dict]: log.debug('reading config file "%s"', path) - config: list[dict] = get_parsed_yaml(path) + config_all: list[dict] = get_parsed_yaml(path) mandatory_config: list[dict] = get_parsed_yaml('mandatory_config.yaml', 'pyssg.plt') - log.info('found %s document(s) for configuration "%s"', len(config), path) + log.info('found %s document(s) for configuration "%s"', len(config_all), path) log.debug('checking that config file is well formed (at least contains mandatory fields') - __check_well_formed_config(config[0], mandatory_config) - __expand_all_paths(config[0]) - return config + for config in config_all: + __check_well_formed_config(config, mandatory_config) + __expand_all_paths(config) + return config_all # not necessary to type deeper than the first dict, diff --git a/src/pyssg/page.py b/src/pyssg/page.py index 6a1ce54..32caadb 100644 --- a/src/pyssg/page.py +++ b/src/pyssg/page.py @@ -44,16 +44,14 @@ class Page: self.cdate_rss: str self.cdate_sitemap: str - self.mdate: str - self.mdate_list: str - self.mdate_list_sep: str - self.mdate_rss: str - self.mdate_sitemap: str - - # later assigned references to next and previous pages - # not always assigned (tail ends), and the None helps check it, ignoring - self.next: Page = None # type: ignore - self.previous: Page = None # type: ignore + self.mdate: str | None = None + self.mdate_list: str | None = None + self.mdate_list_sep: str | None = None + self.mdate_rss: str | None = None + self.mdate_sitemap: str | None = None + + self.next: Page | None = None + self.previous: Page | None = None # also from self.meta, but for og metadata self.og: dict[str, str] = dict() |