Open kj-9 opened 2 weeks ago
hopefully closes #1271
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.74%. Comparing base (
8391966
) to head (6f4acec
). Report is 10 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
I only reviewed tests in depth so far, and it seems the interface is almost exactly what I meant! Awesome!
Quoting from https://github.com/copier-org/copier/issues/1271#issue-1821616806:
are you rendering a filename? No: just let the exception raise and print a nice message "Using yield outside of file names isn't supported".
That seems to be the only missing part. At least I saw no test for that. Could you add this please?
When done I'll review the implementation. This PR is big!
Thank you very much 😊
@yajo
Thank you for your review!
I've added a new commit that implements the behavior you mentioned - throwing an exception when yield is used for rendering file contents. I've also added the corresponding test case.
Looking forward to your implementation review!
What I did:
copier/jinja_ext.py
to handleyield
tagsyield
tags and sets up the necessary context throughjinja_env
_render_path
to return multiple destination paths and their corresponding contexts whenyield
tags are presentyield
tags to the_render_parts
functionextra_context
parameter to_render_file
to enable injection of contexts generated fromyield
tags