entry_templates_from_input
¶
connector_word_pattern = re.compile('(?<=\\s)(?![A-Z])[^\\W\\d_]\\S*(?=\\s)')
module-attribute
¶
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
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
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_connectors_of_missing_placeholders(template, not_provided_placeholders)
¶
Remove connector words between placeholders when an adjacent placeholder is missing.
Why
Templates contain connector words between placeholders (e.g., "in" between DEGREE and AREA, "at" between JOB_TITLE and COMPANY). When a placeholder is removed, these connectors must be dropped too — otherwise orphaned words like "in Computer Science" or "Engineer at" appear in the output.
Example
# "in" removed because DEGREE is missing
remove_connectors_of_missing_placeholders(
"**INSTITUTION**, DEGREE in AREA", {"DEGREE"}
)
# Returns: "**INSTITUTION**, DEGREE AREA"
# "at" removed because COMPANY_NAME is missing
remove_connectors_of_missing_placeholders(
"**JOB_TITLE** at COMPANY_NAME", {"COMPANY_NAME"}
)
# Returns: "**JOB_TITLE** COMPANY_NAME"
Parameters:
-
template(str) –Template string with uppercase placeholders and connector text.
-
not_provided_placeholders(set[str]) –Set of placeholder names that are missing.
Returns:
-
str–Template with connector words adjacent to missing placeholders removed.
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
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 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 | |