From 8a2045c7a146ce8733076586e0c21deb87a392f9 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Wed, 18 Oct 2023 20:05:40 +0200 Subject: [PATCH] imporve section_order validation --- rendercv/data_model.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/rendercv/data_model.py b/rendercv/data_model.py index b916bd2..c2dcd75 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -55,6 +55,9 @@ dictionary = [ "siemens", "dynamometer", "dc", + "grammarly", + "css", + "html" ] @@ -1213,6 +1216,24 @@ class CurriculumVitae(BaseModel): ) sections.append(section) + # Check if any of the pre-defined sections are missing from the section order: + for section_name in pre_defined_sections: + if pre_defined_sections[section_name] is not None: + if section_name not in self.section_order: + logger.warning( + f'The section "{section_name}" is not found in the section' + " order! It will not be rendered." + ) + + # Check if any of the custom sections are missing from the section order: + if self.custom_sections is not None: + for custom_section in self.custom_sections: + if custom_section.title not in self.section_order: + logger.warning( + f'The custom section "{custom_section.title}" is not found in' + " the section order! It will not be rendered." + ) + return sections