Several Handlebars.js spec templates render differently in 3.0.1
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- PHP
- スター
- 77
- フォーク
- 34
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
salesforce/handlebars-php のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
salesforce/handlebars-php#25 · コメント 2 件 · リアクション 2 件 ·
-
rendering with strict=true does not throw for missing nested variables in context対応中かも @hubermat が 1152 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
salesforce/handlebars-php#23 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
salesforce/handlebars-php#22 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
salesforce/handlebars-php#21 · コメント 1 件 · リアクション 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
salesforce/handlebars-php#11 · コメント 1 件 ·
salesforce/handlebars-php の issue をすべて見る
似ている issue
-
bug good first issue small
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
open-telemetry/opentelemetry-php#2164 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
Перевод устарел
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信