Rendering parity: empty containers and undefined render as empty, `-}}` trims only part of the whitespace
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Start with src/internal_value.cpp for stringification, src/statements.cpp for the renderer stream path, and src/template_parser.h for StripBlockRight and its call sites. Reproduce the four templates from the issue, then trace each affected path. Done means empty containers and undefined elements use the expected Python repr forms and -}} removes the full following whitespace run.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Three rendering differences from Jinja2 on the same templates. Boolean spelling is tracked separately in #266 and is not part of this report.
Affected: master 79af49f (releases 1.1.0, 1.2.1 and 1.3.2).
Reproduction
| template | Jinja2 | Jinja2Cpp |
|---|---|---|
{{empty}} where empty is an empty list |
[] |
empty output |
{{[q]}} where q is undefined |
[Undefined] |
empty output |
{{ {} }} |
{} |
empty output |
{{9999-}} followed by \n\t |
9999 |
9999\t |
The first three come from value stringification. The fourth comes from whitespace control: after -}} the engine trims only part of the trailing whitespace run. Top-level output is unaffected, so {{ q }} alone agrees between the engines.
Expected: Python reprs for empty containers and undefined elements, and a full right trim after -}}.
Actual: empty output for the containers and a partial trim after -}}.
Root cause
Value stringification in src/internal_value.cpp and the renderer stream path in src/statements.cpp do not use Python repr forms for sequences, maps, or undefined elements. Whitespace control in src/template_parser.h (StripBlockRight and its call sites) does not consume the whole whitespace run after -}}.
- Lingua principale
- C++
- Stelle
- 602
- Fork
- 115
- Merge medio
- 2h 34m
- PR unite (30g)
- 317
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jinja2cpp/Jinja2Cpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Benchmark drift on masterAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
jinja2cpp/Jinja2Cpp#395 · 20 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di jinja2cpp/Jinja2Cpp
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
notepad-plus-plus/notepad-plus-plus#18553 ·
I maintainer di solito rispondono entro 1 giorno
-
Windows ARM memory-leakApertabug docs performance
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 3 giorni
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
good first issue neural P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100