From 250471b62d90b9d148251393db848bf3db790113 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Sat, 17 Feb 2024 19:09:37 +0100 Subject: [PATCH] add text_alignment option to sb2nov --- rendercv/themes/__init__.py | 5 ++++ rendercv/themes/classic/__init__.py | 6 ----- rendercv/themes/sb2nov/Preamble.j2.tex | 4 +++- schema.json | 32 +++++++++++++++++--------- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/rendercv/themes/__init__.py b/rendercv/themes/__init__.py index 066fc61..c5eb10f 100644 --- a/rendercv/themes/__init__.py +++ b/rendercv/themes/__init__.py @@ -212,6 +212,11 @@ class ThemeOptions(pydantic.BaseModel): " 30 pt." ), ) + text_alignment: Literal["left-aligned", "justified"] = pydantic.Field( + default="justified", + title="Text Alignment", + description="The alignment of the text. The default value is justified.", + ) margins: Margins = pydantic.Field( default=Margins(), title="Margins", diff --git a/rendercv/themes/classic/__init__.py b/rendercv/themes/classic/__init__.py index 23e0269..ac582c3 100644 --- a/rendercv/themes/classic/__init__.py +++ b/rendercv/themes/classic/__init__.py @@ -9,12 +9,6 @@ class ClassicThemeOptions(ThemeOptions): """ """ theme: Literal["classic"] - - text_alignment: Literal["left-aligned", "justified"] = pydantic.Field( - default="justified", - title="Text Alignment", - description="The alignment of the text. The default value is justified.", - ) show_timespan_in: list[str] = pydantic.Field( default=[], title="Show Time Span in These Sections", diff --git a/rendercv/themes/sb2nov/Preamble.j2.tex b/rendercv/themes/sb2nov/Preamble.j2.tex index 6293a9f..fc016ad 100644 --- a/rendercv/themes/sb2nov/Preamble.j2.tex +++ b/rendercv/themes/sb2nov/Preamble.j2.tex @@ -57,7 +57,9 @@ \setlength{\topskip}{0pt} % no top skip % \raggedbottom -% \raggedright +((* if design.text_alignment == "left-aligned"*)) +\raggedright +((* endif *)) \setlength{\tabcolsep}{0in} % Sections formatting diff --git a/schema.json b/schema.json index 7b28ce6..ccd90d9 100644 --- a/schema.json +++ b/schema.json @@ -63,6 +63,16 @@ "title": "Header Font Size", "type": "string" }, + "text_alignment": { + "default": "justified", + "description": "The alignment of the text. The default value is justified.", + "enum": [ + "left-aligned", + "justified" + ], + "title": "Text Alignment", + "type": "string" + }, "margins": { "allOf": [ { @@ -103,16 +113,6 @@ "const": "classic", "title": "Theme" }, - "text_alignment": { - "default": "justified", - "description": "The alignment of the text. The default value is justified.", - "enum": [ - "left-aligned", - "justified" - ], - "title": "Text Alignment", - "type": "string" - }, "show_timespan_in": { "default": [], "description": "The time span will be shown in the date and location column in these sections. The input should be a list of section titles as strings (case-sensitive).", @@ -1056,6 +1056,16 @@ "title": "Header Font Size", "type": "string" }, + "text_alignment": { + "default": "justified", + "description": "The alignment of the text. The default value is justified.", + "enum": [ + "left-aligned", + "justified" + ], + "title": "Text Alignment", + "type": "string" + }, "margins": { "allOf": [ { @@ -1176,6 +1186,7 @@ "page_numbering_style": "NAME -- Page PAGE_NUMBER of TOTAL_PAGES", "show_last_updated_date": true, "header_font_size": "30 pt", + "text_alignment": "justified", "margins": { "entry_area": { "date_and_location_width": "4.1 cm", @@ -1204,7 +1215,6 @@ } }, "theme": "classic", - "text_alignment": "justified", "show_timespan_in": [] }, "description": "The design information of the CV.",