Several Handlebars.js spec templates render differently in 3.0.1
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 57/100
Línea de trabajo
This is ten independent rendering defects: reproduce them one at a time with a short PHP script after composer install, starting with the simplest case (\{{foo}} escaping) to find where the lexer/parser handles escapes, then move to block helpers (#if includeZero, #with else and block params), lookup, @root, zero paths and partial indentation. The parser, Handlebars\Template and Handlebars\Compiler classes carry most of these paths, so read them before touching anything. Add the ten cases as tests first, since the issue is effectively a fixture list. Done means each template renders the expected string and the new tests pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I ran some of Handlebars.js 4.7.10's spec cases through salesforce/handlebars-php 3.0.1 (Packagist, d3a0552d85472249617ef6b56197c844d62d2ac3) and master (0dd1690a5c1fdb785f5d77e4010a240f9eb9d7d7). These ten render differently from Handlebars.js on both. I left out the documented v1.1 data-variable differences and anything already covered by #3, #6, #25 or #26.
{{#if true}} with a boolean literal (blocks.js, "should handle nesting")
Template {{#data}}\n{{#if true}}\n{{.}}\n{{/if}}\n{{/data}}\nOK., data {"data":[1,3,5]}. Expected 1\n3\n5\nOK., got OK.
lookup helper (builtins.js, "should lookup arbitrary content")
Template {{#each goodbyes}}{{lookup ../data .}}{{/each}}, data {"goodbyes":[0,1],"data":["foo","bar"]}. Expected foobar, got an empty string.
includeZero on #if (builtins.js, #if)
Template {{#if goodbye includeZero=true}}GOODBYE {{/if}}cruel {{world}}!, data {"goodbye":0,"world":"world"}. Expected GOODBYE cruel world!, got cruel world!
{{^}} inverse inside a block (blocks.js, "block inverted sections")
Template {{#people}}{{name}}{{^}}{{none}}{{/people}}, data {"none":"No people"}. Expected No people, got an empty string.
#with block parameters (builtins.js, "with provides block parameter")
Template {{#with person as |foo|}}{{foo.first}} {{last}}{{/with}}, data {"person":{"first":"Alan","last":"Johnson"}}. Expected Alan Johnson, got a single space.
#with ... {{else}} (builtins.js, "with with else")
Template {{#with person}}Person is present{{else}}Person is not present{{/with}}, data {}. Expected Person is not present, got both branches: Person is presentPerson is not present.
\{{ escaped mustache (basic.js, escaping)
Template \{{foo}}, data {"foo":"food"}. Expected the literal {{foo}}, got \food.
@root from runtime data (data.js, "passed root values take priority")
Template {{@root.foo}}, context {"foo":"should not be used"}, runtime data.root {"foo":"hello"}. Expected hello, got an empty string.
Zero through a nested path (basic.js, zeros)
Template num: {{num1/num2}}, data {"num1":{"num2":0}}. Expected num: 0, got num: .
Standalone partial indentation (partials.js, "indented partials")
Template Dudes:\n{{#dudes}}\n {{>dude}}\n{{/dudes}}, partial dude = {{name}}\n, data {"dudes":[{"name":"Yehuda","url":"http://yehuda"},{"name":"Alan","url":"http://alan"}]}. Expected Dudes:\n Yehuda\n Alan\n, got Dudes:\nYehuda\nAlan\n. The nested indented partials case behaves the same way.
Happy to turn any of these into test cases for the repo if that's useful.
- Lenguaje dominante
- PHP
- Estrellas
- 77
- Forks
- 34
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de salesforce/handlebars-php
-
Support sub-expressionsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
salesforce/handlebars-php#25 · 2 comentarios · 2 reacciones ·
-
rendering with strict=true does not throw for missing nested variables in contextPosiblemente ocupada @hubermat la tomó hace 1152 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
salesforce/handlebars-php#23 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
salesforce/handlebars-php#22 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
salesforce/handlebars-php#21 · 1 comentario · 4 reacciones ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
salesforce/handlebars-php#11 · 1 comentario ·
Todos los issues de salesforce/handlebars-php
Issues similares
-
bug good first issue small
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
open-telemetry/opentelemetry-php#2164 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Перевод устарел
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día