entry_templates_from_input
¶
unwanted_trailing_parts_pattern = re.compile('[^A-Za-z0-9.!?\\[\\]\\(\\)\\*_%]+$')
module-attribute
¶
uppercase_word_pattern = re.compile('\\b[A-Z_]+\\b')
module-attribute
¶
clean_trailing_parts(text)
¶
Remove trailing characters except alphanumeric and markdown formatting chars.
Why
Placeholder removal can leave trailing separators like commas, colons, or dashes. Regex preserves markdown formatting (brackets, asterisks) while removing unwanted trailing characters.
Example
Parameters:
-
text(str) –Text with potential trailing characters.
Returns:
-
str–
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
process_authors(authors)
¶
Join author names with comma separation.
Parameters:
-
authors(list[str]) –Author names for publication entry.
Returns:
-
str–Comma-separated author string.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
process_date(*, date, start_date, end_date, locale, current_date, show_time_span, single_date_template, date_range_template, time_span_template)
¶
Format date field as single date or range with optional time span.
Why:
Entry date fields vary by type: publications use single dates, experience
uses ranges. This routes to appropriate formatter and optionally appends
duration calculation for employment sections.
Example:
```py
# Single date for publication
result = process_date(
date="2024-03",
start_date=None,
end_date=None,
locale=english_locale,
current_date=Date(2025, 1, 1),
show_time_span=False,
single_date_template="MONTH_NAME YEAR",
date_range_template="",
time_span_template="",
)
# Returns: "March 2024"
# Date range with time span for employment
result = process_date(
date=None,
start_date="2020-06",
end_date="present",
locale=english_locale,
current_date=Date(2025, 1, 1),
show_time_span=True,
single_date_template="MONTH_ABBREVIATION YEAR",
date_range_template="START_DATE to END_DATE",
time_span_template="HOW_MANY_YEARS YEARS",
)
# Returns: "Jun 2020 to present
4 years" ```
Args:
date: Single date for publications and certifications.
start_date: Range start for employment and education.
end_date: Range end for employment and education.
locale: Locale for date formatting.
current_date: Reference date for "present" calculation.
show_time_span: Whether to append duration to date range.
single_date_template: Template for single date formatting.
date_range_template: Template for date range formatting.
time_span_template: Template for duration formatting.
Returns:
Formatted date string, optionally with time span on new lines.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
process_doi(entry)
¶
Format publication DOI as Markdown link to DOI URL.
Example
Parameters:
-
entry(Entry) –Publication entry with DOI.
Returns:
-
str–Markdown link with DOI as display text and DOI URL as target.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
process_highlights(highlights)
¶
Convert highlight list to Markdown unordered list with nested items.
Example
Parameters:
-
highlights(list[str]) –Highlight strings with optional " - " for sub-bullets.
Returns:
-
str–Markdown list string with nested indentation.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
process_summary(summary)
¶
Wrap summary text in Markdown admonition syntax for special rendering in Typst.
Example
Parameters:
-
summary(str) –Summary text to wrap.
Returns:
-
str–Markdown admonition block with indented summary.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
process_url(entry)
¶
Format entry URL as Markdown link with cleaned display text.
Example
Parameters:
-
entry(Entry) –Entry with url or doi field.
Returns:
-
str–Markdown link with cleaned URL as display text.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
remove_not_provided_placeholders(entry_templates, entry_fields)
¶
Remove template placeholders for missing optional fields and surrounding punctuation.
Why
Optional entry fields like location or URL should disappear cleanly from templates when not provided. Regex removal eliminates placeholders plus adjacent punctuation to prevent "Position at " or trailing commas.
Example
Parameters:
-
entry_templates(dict[str, str]) –Template strings with uppercase placeholders.
-
entry_fields(dict[str, str]) –Available field values with uppercase keys.
Returns:
-
dict[str, str]–Templates with missing placeholders and surrounding characters removed.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
render_entry_templates(entry, *, templates, locale, show_time_span, current_date)
¶
Expand entry templates by substituting field placeholders with processed values.
Why
Entry display is user-customizable through YAML templates. This applies templates to entries, processing special fields (dates, highlights, URLs) and removing placeholders for missing optional fields.
Parameters:
-
entry(EntryType) –Entry to process with templates.
-
templates(Templates) –Template collection for entry types and dates.
-
locale(Locale) –Locale for date and text formatting.
-
show_time_span(bool) –Whether to include duration calculation in dates.
-
current_date(date) –Reference date for "present" and time span calculations.
Returns:
-
EntryType–Entry with template-generated display fields.
Source code in src/rendercv/renderer/templater/entry_templates_from_input.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |