Skip to content

Commit b06be54

Browse files
committed
no-mistakes(review): Fix Jinja escape filters, symlink engine, restore-test oracle
1 parent a711e0b commit b06be54

16 files changed

Lines changed: 61 additions & 76 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ here.**
2929
reference the check cannot settle statically is `ERR_TEMPLATE_NOT_STATIC`, and a body that
3030
does not parse is `ERR_TEMPLATE_SYNTAX`. A generated helper over a Jinja body passes the
3131
engine and the payload field tree to `render`, so the check runs again at runtime. Two new
32-
corpora, `fixtures/jinja-render-conformance/` (13) and `fixtures/jinja-verify-conformance/`
32+
corpora, `fixtures/jinja-render-conformance/` (15) and `fixtures/jinja-verify-conformance/`
3333
(31), hold the two ports to identical output and findings. Java, Kotlin and C# render
3434
Mustache only: their providers and `verify` now refuse a Jinja-only body with
3535
`ERR_TEMPLATE_ENGINE_UNSUPPORTED` instead of reporting the ref as unresolved. Mustache stays

‎docs/CONFORMANCE.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ regenerate with `ls -d fixtures/<corpus>/*/ | wc -l` for directory-shaped corpor
3131
| [`fixtures/verify-conformance/`](../fixtures/verify-conformance/) | 37 | ✓ | ✓ | inherits via Java | ✓ | ✓ |
3232
| [`fixtures/verify-strict-conformance/`](../fixtures/verify-strict-conformance/) | 1 | ✓ | — | — | — | ✓ |
3333
| [`fixtures/render-conformance/`](../fixtures/render-conformance/) | 16 | ✓ | ✓ | inherits via Java | ✓ | ✓ |
34-
| [`fixtures/jinja-render-conformance/`](../fixtures/jinja-render-conformance/) (ADR-0061 — Jinja bodies render the same in jinja2 and nunjucks) | 13 | ✓ (nunjucks) | refuses Jinja (`ERR_TEMPLATE_ENGINE_UNSUPPORTED`) | refuses, via Java | refuses Jinja (`ERR_TEMPLATE_ENGINE_UNSUPPORTED`) | ✓ (jinja2) |
34+
| [`fixtures/jinja-render-conformance/`](../fixtures/jinja-render-conformance/) (ADR-0061 — Jinja bodies render the same in jinja2 and nunjucks) | 15 | ✓ (nunjucks) | refuses Jinja (`ERR_TEMPLATE_ENGINE_UNSUPPORTED`) | refuses, via Java | refuses Jinja (`ERR_TEMPLATE_ENGINE_UNSUPPORTED`) | ✓ (jinja2) |
3535
| [`fixtures/jinja-verify-conformance/`](../fixtures/jinja-verify-conformance/) (ADR-0061 — the payload check over a Jinja body) | 31 | ✓ | refuses Jinja | refuses, via Java | refuses Jinja | ✓ |
3636
| [`fixtures/extract-conformance/`](../fixtures/extract-conformance/) | 48 | ✓ | ✓ | inherits the shared JVM engine | ✓ | ✓ |
3737
| [`fixtures/output-prompt-conformance/`](../fixtures/output-prompt-conformance/) | 17 | ✓ | ✓ | ✓ | ✓ | ✓ |
@@ -328,12 +328,12 @@ lookup, parent-context fallthrough, falsy/empty-array section behavior, inverted
328328
sections, nested partials, standalone-tag whitespace stripping, raw-HTML bypass,
329329
trailing-newline preservation, unicode multibyte handling, and the `-last` list-separator accessor.
330330

331-
### `fixtures/jinja-render-conformance/` (13) and `fixtures/jinja-verify-conformance/` (31)
331+
### `fixtures/jinja-render-conformance/` (15) and `fixtures/jinja-verify-conformance/` (31)
332332

333333
Both → [features/templates-and-payloads.md](features/templates-and-payloads.md) (Jinja
334334
templates section, [ADR-0061](../spec/decisions/ADR-0061-per-port-template-engines.md)). Run by
335335
Python (jinja2) and TypeScript (nunjucks) only; Java, Kotlin and C# refuse a Jinja body with
336-
`ERR_TEMPLATE_ENGINE_UNSUPPORTED` instead. The render corpus holds 10 output cases and 2 error
336+
`ERR_TEMPLATE_ENGINE_UNSUPPORTED` instead. The render corpus holds 13 output cases and 2 error
337337
cases (an include cycle and an unresolved include), each with the same Mustache-path message.
338338
The verify corpus reuses `verify-conformance/`'s `payload.json` field-tree shape; an
339339
`ERR_TEMPLATE_SYNTAX` finding's path is the parser's own message, so runners compare it as

‎docs/features/templates-and-payloads.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ for the per-port pass/skip ledger.
788788

789789
**Jinja bodies (Python and TypeScript, ADR-0061)**
790790

791-
- [`fixtures/jinja-render-conformance/`](../../fixtures/jinja-render-conformance/) — 13 cases: variables, loops, conditionals, `set` and macros, `include` and `import`, filters, html and json escaping, whitespace control, `raw` and comments, plus an include cycle and an unresolved include. Byte-identical output from jinja2 and nunjucks.
791+
- [`fixtures/jinja-render-conformance/`](../../fixtures/jinja-render-conformance/) — 15 cases: variables, loops, conditionals, `set` and macros, `include` and `import`, filters, html and json escaping (with and without `| escape`), whitespace control, `raw` and comments, plus an include cycle and an unresolved include. Byte-identical output from jinja2 and nunjucks.
792792
- [`fixtures/jinja-verify-conformance/`](../../fixtures/jinja-verify-conformance/) — 31 cases: the payload check over the parsed template (paths, loop targets, locals, filters, includes, imports, `extends` blocks, `ERR_TEMPLATE_NOT_STATIC`, `ERR_TEMPLATE_SYNTAX`, required slots and tags).
793793

794794
## See also
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>Tom &amp; &quot;Jerry&quot; &lt;it&#39;s&gt;</p>
2+
<p>Tom &amp; &quot;Jerry&quot; &lt;it&#39;s&gt;</p>
3+
<div><b>bold</b></div>
4+
<div>&lt;b&gt;bold&lt;/b&gt;</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"format": "html",
3+
"note": "| escape, | e and | forceescape use the format's escaper, not the engine's own HTML escaper; an escaped value is not escaped again, and | forceescape escapes a value marked | safe"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Tom & \"Jerry\" <it's>",
3+
"markup": "<b>bold</b>"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>{{ title | e }}</p>
2+
<p>{{ title | escape | e }}</p>
3+
<div>{{ markup | safe | e }}</div>
4+
<div>{{ markup | safe | forceescape }}</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"e": "she said \"hi\"\nbye", "escape": "she said \"hi\"\nbye", "force": "she said \"hi\"\nbye"}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"format": "json",
3+
"note": "json format: | escape, | e and | forceescape JSON-string escape, so a template written with the Jinja escape idiom still builds a valid JSON document"
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"quote": "she said \"hi\"\nbye"
3+
}

0 commit comments

Comments
 (0)