Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dynamic file structures in loop using yield-tag #1855

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kj-9
Copy link

@kj-9 kj-9 commented Nov 10, 2024

What I did:

  • Added a new Jinja extension in copier/jinja_ext.py to handle yield tags
    • This is a lightweight extension that detects yield tags and sets up the necessary context through jinja_env
  • Updated _render_path to return multiple destination paths and their corresponding contexts when yield tags are present
    • Internally, delegated the recursive logic for generating paths and contexts from yield tags to the _render_parts function
  • Added extra_context parameter to _render_file to enable injection of contexts generated from yield tags

… extention for yield tag, allow _render_path to generate mulitple paths and contexts when yield tag is used
… test file to test dynamic file structure feature
@kj-9
Copy link
Author

kj-9 commented Nov 10, 2024

hopefully closes #1271

Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.73%. Comparing base (8391966) to head (7164aa7).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1855      +/-   ##
==========================================
+ Coverage   97.67%   97.73%   +0.06%     
==========================================
  Files          49       51       +2     
  Lines        5238     5349     +111     
==========================================
+ Hits         5116     5228     +112     
+ Misses        122      121       -1     
Flag Coverage Δ
unittests 97.73% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sisp sisp self-requested a review November 12, 2024 20:56
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.

1 participant