diff --git a/rendercv/renderer.py b/rendercv/renderer.py index 2dd3b7c..9db5081 100644 --- a/rendercv/renderer.py +++ b/rendercv/renderer.py @@ -113,12 +113,12 @@ class LaTeXFile(TemplatedFile): data_model: dm.RenderCVDataModel, environment: jinja2.Environment, ): - latexfile_data_model = copy.deepcopy(data_model) + latex_file_data_model = copy.deepcopy(data_model) transformed_sections = transform_markdown_sections_to_latex_sections( - latexfile_data_model.cv.sections_input + latex_file_data_model.cv.sections_input ) - latexfile_data_model.cv.sections_input = transformed_sections - super().__init__(latexfile_data_model, environment) + latex_file_data_model.cv.sections_input = transformed_sections + super().__init__(latex_file_data_model, environment) def render_templates(self) -> tuple[str, str, list[tuple[str, list[str], str]]]: """Render and return all the templates for the $\\LaTeX$ file. @@ -138,7 +138,7 @@ class LaTeXFile(TemplatedFile): entries: list[str] = [] for i, entry in enumerate(section.entries): is_first_entry = i == 0 - + entries.append( self.template( section.entry_type, @@ -183,15 +183,19 @@ class LaTeXFile(TemplatedFile): # ones with \textnormal: # Find all the nested commands: - nested_commands = re.findall(r"\\textbf{[^}]*?(\\textbf{.*?})", result) - nested_commands += re.findall(r"\\textit{[^}]*?(\\textit{.*?})", result) - nested_commands += re.findall(r"\\underline{[^}]*?(\\underline{.*?})", result) + nested_commands = re.findall( + r"\\textbf{[^}]*?(\\textbf{.*?})|\\textit{[^}]*?(\\textit{.*?})" + r"|\\underline{[^}]*?(\\underline{.*?})", + result, + ) # Replace the inner commands with \textnormal: for nested_command in nested_commands: - new_command = nested_command.replace("textbf", "textnormal") - new_command = new_command.replace("textit", "textnormal") - new_command = new_command.replace("underline", "textnormal") + new_command = ( + nested_command.replace("textbf", "textnormal") + .replace("textit", "textnormal") + .replace("underline", "textnormal") + ) result = result.replace(nested_command, new_command) return result @@ -855,7 +859,8 @@ def copy_theme_files_to_output_directory( ) for theme_file in theme_directory_path.iterdir(): - if not ("j2.tex" in theme_file.name or "py" in theme_file.name): + dont_copy_files_with_these_extensions = [".j2.tex", ".py"] + if theme_file.suffix not in dont_copy_files_with_these_extensions: if theme_file.is_dir(): shutil.copytree( str(theme_file),