Render placeholders located in hyperlink URLs#650
Conversation
|
Thanks for the PR. I took a local pass through this because rendering relationship targets seems like the right place to fix hyperlink URLs. What I checked locally on
One edge case I found: when callers pass a custom Minimal reproduction from the new fixture: from jinja2 import Environment
env = Environment(variable_start_string="[[", variable_end_string="]]")
# relationship target is [[ foo ]]
# visible document text renders, but word/_rels/document.xml.rels still contains [[ foo ]]For a relationship-only variable using those delimiters, A small way to keep this aligned with the provided environment would be to base the marker check on the active environment, for example using With that handled, this looks like a useful feature and the fixture is a good addition. |
As of today, if you create a hyperlink in your docx template, placeholders such as
{{ foo }}are rendered only in the visible text of the hyperlink but are ignored if placed in the destination URL.With this simple PR, we'll render those templates even in the URL part making it fully customizable.