Repository navigation
Bump Handlebars.Net from 2.4.3 to 2.5.0 - #17855
Open
dependabot[bot] wants to merge 1 commit into
Open
dependabot[bot] wants to merge 1 commit into
dependabot[bot] wants to merge 1 commit into
Conversation
--- updated-dependencies: - dependency-name: Handlebars.Net dependency-version: 2.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated Handlebars.Net from 2.4.3 to 2.5.0.
Release notes
Sourced from Handlebars.Net's releases.
2.5.0
2.5.0 brings Handlebars.Net closer to handlebars.js. It adds
JsonNodesupport, and compile errors now report where they happened. Several long-standing differences from handlebars.js are now fixed by default. Each fix that changes output for templates that used to compile has aConfiguration.Compatibilityflag that restores the old behavior, and the new compile errors name that flag. All compatibility flags are read at compile time, so set them before callingCompile.Compatibility notes
These changes can alter output, or turn a template that used to compile into an error. Read them before upgrading.
A standalone
{{^}}inside a block is now the inverse separator, the same as{{else}}, as in handlebars.js. This applies to#if,#unless,#each,#with, sections and custom block helpers, and to the{{^ }}and{{~^~}}forms. Inside raw blocks{{^}}is still literal text. To restore the previous behavior, setCompatibility.LegacyStandaloneCaretBehavior = true. (#675, fixes #672; #692){{#if condition}}yes{{^}}no{{/if}}yes{ condition = True }noyes{{#if condition}}yes{{^}}no{{/if}}no{{#each people}}{{name}}{{^}}No one{{/each}}[]No oneA second
{{^}}in the same#if/#unless(e.g.{{#if x}}a{{^}}b{{^}}c{{/if}}) is now a compile error, and its message names the opt-out.Inline partials declared inside a block or partial are now scoped to that block, as in handlebars.js. The new
Compatibility.BlockScopedInlinePartialssetting defaults totrue. To restore the previous behavior, where such partials leaked into the enclosing scope and replaced outer partials with the same name, set it tofalse. When a partial can't be resolved because of this scoping, the error message names the opt-out. (#688, #692, fixes #673, #690){{#*inline "p"}}outer{{/inline}}{{#with .}}{{#*inline "p"}}inner{{/inline}}{{> p}}{{/with}} {{> p}}inner innerinner outer{{#with .}}{{#*inline "myPartial"}}success{{/inline}}{{/with}}{{> myPartial}}success{{> macros}}{{> button label="OK"}}, where partialmacrosdeclares{{#*inline "button"}}<button>OK</button>To migrate, move such declarations to the top level of the template or register them with
RegisterTemplate. Either works with the setting on or off.{{else …}}chains under{{#if}}/{{#unless}}now follow handlebars.js.{{else name args}}now means{{else}}{{#name args}}…{{/name}}. Before, any two-word form was treated as{{else if x}}, and any other form silently became a plain{{else}}. (#687, #689, #696, fixes #683, #695; based on #684 by @EnesKartal){{else unless x}}now hasunlesssemantics. Before, it was evaluated as{{else if x}}, which inverted the condition.{{else someHelper x}}now invokessomeHelper. Before, it ignored the helper and usedxas the condition. If the helper isn't registered, rendering throws the usual missing-helperHandlebarsRuntimeException.{{else name}}now opens a block onname. Ifnameis a registered block helper it is invoked. Otherwise the branch renders only whennameis truthy, and iterates when it is a list. A bare{{else if}}/{{else unless}}with no condition is now a compile error. To restore the previous bare-name behavior, where the name was ignored and the branch rendered as a plain{{else}}, set the newCompatibility.LegacyBareElseNameBehavior = true.{{else if a b}}/{{else unless a b}}(too many arguments) and{{else}}followed by another{{else}}now throwHandlebarsCompilerException. Before, these rendered the branch or threwArgumentNullException.ArgumentNullExceptionnow work:{{else if b includeZero=true}}, and a custom-helper chain followed by{{else}}.{{#if user.isAdmin}}Admin tools{{else user.isModerator}}Moderator tools{{/if}}Moderator tools{{#if a}}A{{else unless b}}B{{else}}C{{/if}}CB{{#if a}}A{{else ifEq b "y"}}B{{/if}}(ifEqregistered)B{{#if a}}A{{else items}}[{{this}}]{{/if}}[+ outer context +][1][2]{{#if a}}A{{else if}}B{{/if}}BHandlebarsCompilerExceptionJsonNodebehavior (#670 by @jsneedles):false,0and""in aJsonNodeare now falsy in#ifand similar helpers. Before, they were truthy.JsonObjectmember lookups now fall back to the lowercase name, asJsonElementlookups do.JsonElementandJsonObjectmembers.Compile error messages and exception types:
{{#if}}/{{#unless}}with no argument now throwsHandlebarsCompilerException(#if requires exactly one argument). Before, it threwInvalidOperationException. With too many arguments, it throws the same exception type as before, but the message now reads the same way. (#678, fixes #674)Line n, column n.followed by the template line and a caret under the error. The oldOccured at: n:ntext is gone. Code that compares the full message exactly, or searches it forOccured at:, needs updating. Use the newHandlebarsException.Line/Columnproperties instead. (#680, #681, #682, fixes #314)New features
... (truncated)
2.4.4
New features
System.Text.JsonJsonNodesupport. You can now passJsonObject,JsonArrayandJsonValueinto templates directly. They support the same things asJsonElement: member access,#eachwith@index/@key/@first/@last, truthiness,includeZeroand partials.JsonElementalso gains array index access ({{items.[0]}},{{lookup items 1}}),{{items.Count}}(plus{{items.length}}withUseCollectionMemberAliasProvider()), and support for custom alias providers. New public types:JsonNodeObjectDescriptorProvider,JsonNodeMemberAccessor,JsonNodeIterator.JsonElementObjectDescriptorProviderandJsonElementMemberAccessorget new constructor overloads that take alias providers. (#670)HandlebarsExceptionhas newLineandColumnproperties (int?, zero-based,nullwhen the location isn't known). The derived compiler, parser and runtime exceptions inherit them. When a compile-time error has a location, its message now ends with the offending template line and a caret under the column. (#681, refs #314){{#if !x}}now says that!isn't a negation operator and points you to#unless. Unclosed blocks, stray closing tags and mismatched}}}now report where they happened. (#680, refs #314)Compatibility.BlockScopedInlinePartials(opt-in, defaultfalse): when enabled, an inline partial declared inside a block or an included partial is visible only within that block and its children, as in Handlebars.js. With the default, existing behavior is unchanged. (#688, refs #673)Compatibility.LegacyStandaloneCaretBehavior: a new opt-out flag that restores the old{{^}}behavior (see Fixes). (#675, fixes #672)Fixes
{{^}}inside a block (also{{^ }}and{{~^~}}) is now the inverse separator, the same as{{else}}, matching Handlebars.js. Inside raw blocks it stays literal text. (#675, fixes #672){{else name args}}under{{#if}}/{{#unless}}now chains to the named helper, as in Handlebars.js. Previously it was evaluated as{{else if …}}, or the condition was silently dropped.{{else unless x}}now hasunlesssemantics, and{{else with x}}chains to the built-inwith. (#687, #689, fixes #683){{#if}}/{{#unless}}with a missing argument now throwHandlebarsCompilerExceptioninstead of a bareInvalidOperationException. (#678, fixes #674)Compatibility.RelaxedHelperNaming = true. (#677, fixes #676){{#each}}over items of different runtime types now looks each item's members up by its own type. Before, a dictionary followed by a number threwInvalidCastException, and a number followed by a dictionary rendered empty. For example,{{#each items}}[{{name}}]{{/each}}over[{name: "Erik"}, 42, {name: "Helen"}]now renders[Erik][][Helen]. Collections whose items all share one type behave as before. (#691, fixes #685)JsonArraymember access is limited to indexes,Countand configured aliases, soParent/Root/Optionsno longer resolve through reflection. ScalarJsonValues read throughJsonSerializerno longer throw. (#670)Internal
ReusableStringWriter(it has only a private constructor, so this doesn't break anything), and split upTokenizer/LiteralParsermethods for the SonarCloud S3881/S3776 items. No behavior change. (#679, closes #641)Compatibility notes
Some templates and code that worked before will behave differently:
{{^}}inside a block used to render the current context, and the block had no inverse branch. It is now{{else}}. For example,{{#if condition}}yes{{^}}no{{/if}}withcondition = trueused to renderyes{ condition = True }noand now rendersyes. Withcondition = falseit used to render nothing and now rendersno. To restore the old output, setConfiguration.Compatibility.LegacyStandaloneCaretBehavior = true. (#675){{else unless x}}under{{#if}}used to be evaluated as{{else if x}}, which inverted the condition.{{else someHelper x}}used to ignoresomeHelper. It now calls it, and throws the usual missing-helperHandlebarsRuntimeExceptionifsomeHelperisn't registered.{{else if a b}}and{{else unless a b}}(too many arguments) and a second{{else}}now fail at compile time. Plain{{else}},{{else if x}}and a bare{{else name}}are unchanged. (#687)Occured at: l:ctoLine l, column c., and located compile errors now end with a source line and a caret. Code that matches on the exception type or message prefix keeps working. Code that searches forOccured at:or compares the fullMessagewill not match. Use the newLine/Columnproperties instead.{{#if}}with no argument now throwsHandlebarsCompilerExceptioninstead ofInvalidOperationException. With too many arguments, it now says#if requires exactly one argument. (#678, #680, #681, #682)JsonNode:false,0and""are now falsy in#if/#unless/#each. Before, they were truthy.JsonObjectlookups now fall back to the lowercase property name. Custom member alias providers are now consulted forJsonElementandJsonObjectmembers that don't otherwise resolve. When interpolated directly,JsonNodebooleans still render astrue/false, whileJsonElementbooleans render asTrue/False. (#670)Contributors: @jsneedles (
JsonNodesupport), @EnesKartal (#684, whose test case and approach were incorporated into #687/#689), @bardrop (#686, whose fix and tests were incorporated into #691), @rexmFull Changelog: Handlebars-Net/Handlebars.Net@2.4.3...2.4.4
Commits viewable in compare view.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)