render/include/section calls with a literal name: (file, line, name, expected path).
(root: Path)
| 191 | |
| 192 | |
| 193 | def cases_a(root: Path) -> list[tuple[str, int, str, str]]: |
| 194 | """render/include/section calls with a literal name: (file, line, name, expected path).""" |
| 195 | out: list[tuple[str, int, str, str]] = [] |
| 196 | for p in _liquid_files(root): |
| 197 | text = _read(p) |
| 198 | masked = mask_inactive(text) |
| 199 | ln = _Lines(masked) |
| 200 | rel = _rel(root, p) |
| 201 | for m in _TAG.finditer(masked): |
| 202 | body = m.group(1) |
| 203 | nm = _TAG_NAME.match(body) |
| 204 | name = nm.group(1) if nm else "" |
| 205 | if name == "liquid": |
| 206 | base = m.start(1) |
| 207 | for lm in re.finditer(r"^[ \t]*(render|include|section)[ \t]+(['\"])([^'\"\n]+)\2", body, re.M): |
| 208 | out.append((rel, ln.of(base + lm.start()), lm.group(3), _expected(lm.group(1), lm.group(3)))) |
| 209 | elif name in ("render", "include", "section"): |
| 210 | cm = _CALL.match(body.lstrip()) |
| 211 | if cm: |
| 212 | off = m.start(1) + (len(body) - len(body.lstrip())) |
| 213 | out.append((rel, ln.of(off), cm.group(3), _expected(cm.group(1), cm.group(3)))) |
| 214 | return out |
| 215 | |
| 216 | |
| 217 | def _expected(kind: str, name: str) -> str: |
no test coverage detected