Several Handlebars.js spec templates render differently in 3.0.1
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 57/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 77
- Fork
- 34
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của salesforce/handlebars-php
-
Support sub-expressionsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
salesforce/handlebars-php#25 · 2 bình luận · 2 reaction ·
-
rendering with strict=true does not throw for missing nested variables in contextCó thể đã có người làm @hubermat đã nhận 1152 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
salesforce/handlebars-php#23 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
salesforce/handlebars-php#22 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
salesforce/handlebars-php#21 · 1 bình luận · 4 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
salesforce/handlebars-php#11 · 1 bình luận ·
Tất cả issue của salesforce/handlebars-php
Issue tương tự
-
bug good first issue small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
open-telemetry/opentelemetry-php#2164 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Перевод устарел
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày