update theme options

This commit is contained in:
Sina Atalay 2024-02-15 19:46:18 +01:00
parent 54a39e59a3
commit 2bdb4fb063
3 changed files with 35 additions and 64 deletions

View File

@ -3,35 +3,8 @@ from typing import Literal, Annotated
import pydantic import pydantic
import pydantic_extra_types.color as pydantic_color import pydantic_extra_types.color as pydantic_color
LaTeXDimension = Annotated[ from .. import LaTeXDimension
str, from .. import PageMargins
pydantic.Field(
pattern=r"\d+\.?\d* *(cm|in|pt|mm|ex|em)",
),
]
class ClassicThemePageMargins(pydantic.BaseModel):
top: LaTeXDimension = pydantic.Field(
default="2 cm",
title="Top Margin",
description="The top margin of the page with units.",
)
bottom: LaTeXDimension = pydantic.Field(
default="2 cm",
title="Bottom Margin",
description="The bottom margin of the page with units.",
)
left: LaTeXDimension = pydantic.Field(
default="1.24 cm",
title="Left Margin",
description="The left margin of the page with units.",
)
right: LaTeXDimension = pydantic.Field(
default="1.24 cm",
title="Right Margin",
description="The right margin of the page with units.",
)
class ClassicThemeSectionTitleMargins(pydantic.BaseModel): class ClassicThemeSectionTitleMargins(pydantic.BaseModel):
@ -98,8 +71,8 @@ class ClassicThemeHeaderMargins(pydantic.BaseModel):
class ClassicThemeMargins(pydantic.BaseModel): class ClassicThemeMargins(pydantic.BaseModel):
page: ClassicThemePageMargins = pydantic.Field( page: PageMargins = pydantic.Field(
default=ClassicThemePageMargins(), default=PageMargins(),
title="Page Margins", title="Page Margins",
description="Page margins for the classic theme.", description="Page margins for the classic theme.",
) )

View File

@ -2,13 +2,7 @@ from typing import Literal, Annotated
import pydantic import pydantic
from .. import LaTeXDimension
LaTeXDimension = Annotated[
str,
pydantic.Field(
pattern=r"\d+\.?\d* *(cm|in|pt|mm|ex|em)",
),
]
class ModerncvThemeOptions(pydantic.BaseModel): class ModerncvThemeOptions(pydantic.BaseModel):

View File

@ -2,13 +2,7 @@ from typing import Literal, Annotated
import pydantic import pydantic
from .. import LaTeXDimension, PageMargins
LaTeXDimension = Annotated[
str,
pydantic.Field(
pattern=r"\d+\.?\d* *(cm|in|pt|mm|ex|em)",
),
]
class Sb2novThemeOptions(pydantic.BaseModel): class Sb2novThemeOptions(pydantic.BaseModel):
@ -28,13 +22,31 @@ class Sb2novThemeOptions(pydantic.BaseModel):
title="Page Size", title="Page Size",
description="The page size of the CV. It can be a4paper or letterpaper.", description="The page size of the CV. It can be a4paper or letterpaper.",
) )
disable_page_numbering: bool = pydantic.Field(
default=False, link_color: (
title="Disable Page Numbering", Literal["black"]
description=( | Literal["red"]
"If this option is set to true, then the page numbering will be disabled." | Literal["green"]
), | Literal["blue"]
| Literal["cyan"]
| Literal["magenta"]
| Literal["yellow"]
) = pydantic.Field(
default="cyan",
validate_default=True,
title="Link Color",
description="The color of the links in the CV.",
examples=[
"black",
"red",
"green",
"blue",
"cyan",
"magenta",
"yellow",
],
) )
date_and_location_width: LaTeXDimension = pydantic.Field( date_and_location_width: LaTeXDimension = pydantic.Field(
default="4.1 cm", default="4.1 cm",
title="Date and Location Column Width", title="Date and Location Column Width",
@ -47,19 +59,6 @@ class Sb2novThemeOptions(pydantic.BaseModel):
"The space between the connection objects (like phone, email, and website)." "The space between the connection objects (like phone, email, and website)."
), ),
) )
text_alignment: Literal["left-aligned", "justified"] = pydantic.Field(
default="left-aligned",
title="Text Alignment",
description="The alignment of the text.",
)
show_timespan_in: list[str] = pydantic.Field(
default=[],
title="Show Time Span in These Sections",
description=(
"The time span will be shown in the date and location column in these"
" sections. The input should be a list of strings."
),
)
show_last_updated_date: bool = pydantic.Field( show_last_updated_date: bool = pydantic.Field(
default=True, default=True,
title="Show Last Updated Date", title="Show Last Updated Date",
@ -73,3 +72,8 @@ class Sb2novThemeOptions(pydantic.BaseModel):
title="Header Font Size", title="Header Font Size",
description="The font size of the header (the name of the person).", description="The font size of the header (the name of the person).",
) )
margins: PageMargins = pydantic.Field(
default=PageMargins(),
title="Margins",
description="The page margins of the CV.",
)