FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Expose TIME_SPAN as an independent template placeholder by ciguarin · Pull Request #770 · rendercv/rendercv · GitHub

Expose TIME_SPAN as an independent template placeholder - #770

Open
ciguarin wants to merge 1 commit into
rendercv:mainfrom
ciguarin:fix/expose-time-span-placeholder
Open

Expose TIME_SPAN as an independent template placeholder#770
ciguarin wants to merge 1 commit into
rendercv:mainfrom
ciguarin:fix/expose-time-span-placeholder

Conversation

Copy link
Copy Markdown

Summary

Closes #547.

Previously, the calculated duration (e.g. "2 years 3 months") was only ever appended to the DATE placeholder's value, joined by two newlines, with no way for a custom entry template to access it on its own. This made it impossible to position the time span independently in a custom layout, which is exactly what was reported in #547.

process_date now returns (date_string, time_span_string) instead of a single pre-concatenated string. DATE keeps its exact existing value for full backward compatibility with themes that only ever used DATE; when show_time_span is true, TIME_SPAN is also added to entry_fields so custom templates can reference it directly.

Changes

  • src/rendercv/renderer/templater/entry_templates_from_input.py: process_date returns a tuple; render_entry_templates sets DATE (unchanged output) and, when applicable, the new TIME_SPAN field.
  • tests/renderer/templater/test_entry_templates_from_input.py: updated the two existing tests whose assertions depended on process_date's old return type, and added two new tests covering the actual fix (TIME_SPAN available on its own, and correctly dropped when show_time_span is false).
  • docs/user_guide/yaml_input_structure/design.md: mentioned TIME_SPAN where the Templates section already lists available placeholders, since that's the doc the issue reporter would have read and found no mention of it.

Testing

  • Reproduced the reported bug against the issue's own example config before making any change (confirmed TIME_SPAN silently vanished from output).
  • Full suite passes: just test (1540 passed).
  • just check (ruff + ty) clean.
  • Confirmed byte-identical output on the default classic theme with show_time_spans_in enabled, to verify backward compatibility.

Note

This is my first PR to this project. I set up the dev environment via the developer guide and worked through this with Claude Code, per the suggestion in #672.

Previously, the calculated duration (e.g. "2 years 3 months") was only
ever appended to the DATE placeholder's value, joined by two newlines,
with no way for a custom entry template to access it on its own. This
made it impossible to position the time span independently in a custom
layout (see rendercv#547).

process_date now returns (date_string, time_span_string) instead of a
single pre-concatenated string. DATE keeps its exact existing value for
full backward compatibility with themes that only ever used DATE; when
show_time_span is true, TIME_SPAN is also added to entry_fields so
custom templates can reference it directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Question/Feature Request] What is the placeholder keyword for time_span in custom entry templates?

1 participant


Back | FazBrowse Home | New Git URL