Template: resolve relative includes against the including file directory

Open
#600 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
backend, web-dev

Research direction

Start by locating the template include resolver and its tests; the payload does not name their paths. Trace how the including template’s directory and the process working directory are used, then check the documented base-directory policy. Done means nested relative includes resolve consistently from another working directory, absolute paths remain unchanged, and recursive includes are still rejected.

Written by the indexing model from the issue text.

Description

enhancement

Summary

File includes currently interpret a relative path against the process working directory rather than the directory of the template containing the include.

Proposed improvement

When rendering /views/pages/home.html, {% include "partials/nav.html" %} should resolve to /views/pages/partials/nav.html, or to /views/partials/nav.html according to the documented base-directory policy. Keep absolute paths unchanged and preserve include-depth enforcement.

Tests

Cover nested relative includes from different directories, invocation from an unrelated working directory, absolute paths, and recursive include rejection.

Dominant language
C
Stars
16
Forks
7
Avg merge
4h 28m
Merged PRs (30d)
191

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.