-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Layered Jinja templates with the same name #17
Comments
django templating system has solved this problem. Let me check if jinja2 has anything similiar. |
I got no luck with jinja2. The closest choice was ChoiceLoader but it is clever enough to understand The work around would be putting files under a special directory: .moban.dt/local-override/setup.py.jj2 And then use this configuration
Well, technically, there could be one more choice is to implement such a overlapping template loader by extending jinja2's baseloader. However, this may take some unknown time. |
ChoiceLoader sounds perfect, with each item in template_dir becomes a choice in ChoiceLoader. I did some quick hacking a few months ago and found jinja kept want to recurse, forever. I could see an easy hook into jinja to help it. The 'two local subdirectories' workaround occurred to me, and .. eww. A worse workaround is to add But, a different solution is to allow |
This won't be solved easily in near term. Let me sort out the easy ones first. |
we are now using jinja2-fsloader. I am sure we will work this out ever. Hence, I am closing this issue. |
I must admit I am not sure this is a great idea...but IMO is worth discussing.
Currently it is not possible to have two templates with the same name. That prevents a local one vs a global one.
One example:
.moban.dt/MANIFEST.in.jj2
with block 'more_options'Another:
.moban.dt/setup.py.jj2
with blocksThat could be confusing, but then creating local templates with variant template names is also confusing, and annoying as they will have a common and unnecessary prefix.
The text was updated successfully, but these errors were encountered: