jet: include & extend don't handle absolute paths correctly
Assuming I have a template at foo/baz.jet
, {{ include "foo/bar.jet" }}
will make resolveNameSibling
try to resolve foo/foo/bar.jet
before resolving foo/bar.jet
: https://github.com/CloudyKit/jet/blob/33cfc27b3e00072655fdb3af24c3253ea5bffb8f/template.go#L153
name
will be "foo/bar.jet"
, sibling
will be "foo/baz.jet"
.
I would like to simplify template resolving & loading and could fix this issue at the same time. Seeing as we are making breaking changes with v3 anyway, I would like to make jet handle paths like most software does:
./asd.jet
,asd.jet
,../asd.jet
will be treated as relative paths and will be resolved relative to the current template’s path/foo.jet
,/foo/bar.jet
will be treated as absolute paths and will be looked up directly in the templates cache and/or the loader, without using the current template’s path
Do you want me to proceed with this? Did I miss something?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (4 by maintainers)
@sauerbraten Thank you, I didn’t describe it clearly before 😃