Releases: Handlebars-Net/Handlebars.Net
2.0.0-rc-1
Changes
Features 🚀
-
Introduce
AmbientContext@zjklee (#391)What's inside:
- Introduce
AmbientContext - Move
PathInfoand related classes to a separate namespace - Improve GC-friendliness:
PathInfoStoreandChainSegmentStoreare now associated with the compiled template instead of being static
- Introduce
-
Introduce value formatters @zjklee (#390)
What's inside:
- support for custom value formatters
Issues:
-
Expose inner interfaces in configuration @zjklee (#388)
What's inside:
- Extend existing and introduce new interfaces.
This is done to expose only required APIs and trim internal collections implementation. - Improve and trim implementations of internal collections.
- Improve
PathInfoandChainSegmentparsing.
- Extend existing and introduce new interfaces.
Bug Fixes 🐛
-
Use
Closes /issues/383ParentContextwhen handling@partial-block@zjklee (#386)
Breaking change ⛔
-
Introduce value formatters @zjklee (#390)
- changes to
ITextEncoderinterface - use ISO 8601 formatting for DateTime
- changes to
-
Expose inner interfaces in configuration @zjklee (#388)
- Replace default collection interfaces by local equivalents. This is done to trim API surface.
-
Introduce
Contexttype @zjklee (#385)contextparameters is no longerdynamic
Handlebars.RegisterHelper("link_to", (writer, context, parameters) => { writer.WriteSafeString("<a href='" + (string)context.url + "'>" + (string)context.text + "</a>"); });
Is changed to:
Handlebars.RegisterHelper("link_to", (writer, context, parameters) => { writer.WriteSafeString($"<a href='{context["url"]}'>{context["text"]}</a>"); });
Contributors
@perlun, @sferencik, @zjklee
2.0.0-preview-2
Changes
Features 🚀
-
Introduce
IIterator@zjklee (#381)What's inside:
- Introduces
IIteratorinterface - Extends
ObjectDescriptorwith iterator definition
Issues:
- closes /issues/372
- Introduces
-
Introduce
HelperOptionsto Helper and ReturnHelper @zjklee (#378)What's inside:
- Introduce
HelperOptionsto Helper and ReturnHelper
Issues:
- closes /issues/320
- Introduce
-
@dataandnoEscape@zjklee (#375)What's inside:
- support for
@databeing passed to compiled template - support
noEscapeconfiguration
Issues:
- closes /issues/368
- closes /issues/276
- closes /issues/339
- support for
Bug Fixes 🐛
-
Fix whitespace support for partials @zjklee (#382)
Closes /issues/217
Breaking change ⛔
-
Introduce
HelperOptionsHelper and ReturnHelper @zjklee (#378)HelperOptionsstruct in block helpers renamed toBlockHelperOptions
-
@dataandnoEscape@zjklee (#375)- changed public API types in several places, semantic is still more or less the same
Performance 🐌
-
@dataandnoEscape@zjklee (#375)- improved overall performance (2x - 3x faster)
- improved memory management (3x - 5x less memory allocations)
Contributors
@zjklee
2.0.0-preview-1
Changes
Features 🚀
-
Infrastructure improvements @zjklee (#371)
What's inside:
- Implement
dataproperty forblockHelpers - Improve
blockParamsforblockHelpers
Issues:
- closes /issues/322
- closes /issues/122
- closes /issues/107
- Implement
-
Merging fork into trunk @zjklee (#359)
What's inside (inspired by /issues/294):
- fixes to multiple Github issues:
- BlockParams support (closes /issues/301)
- Support returning objects from helpers (closes /issues/264)
- Lookup helper (closes /issues/268)
- JObject performance problems (closes /issues/308)
- Support more advanced helper construction (closes /issues/151, closes /issues/151)
- Support helper resolvers (closes /issues/336)
- Block helper inversion (closes /issues/354)
helperMissingandblockHelperMissing(closes /issues/350)- configurable
IFormatProvider(closes /issues/344) blockHelperlate binding (closes /issues/327, closes /issues/194)- Other issues:
- closes /issues/351
- closes /issues/347
- closes /issues/307
- closes /issues/243
- contribution to /issues/314
- fixes to multiple Github issues:
Performance 🐌
-
Infrastructure improvements @zjklee (#371)
- Rework helper registration to use pub/sub approach
- Improve path resolver performance
-
Merging fork into trunk @zjklee (#359)
- global refactoring (without breaking changes to the public API)
- use zjklee/ExpressionShortcuts to improve maintainability of Expression Trees
- improvements to extensibility
- performance improvements (depends on template complexity):
- 2-10x compilation time improvement
- 2-10x execution time improvement
- up to 20x less memory consumption during compilation and execution
- global refactoring (without breaking changes to the public API)
Performance insights
BenchmarkDotNet=v0.12.1, OS=ubuntu 18.04
Intel Xeon CPU E5-2673 v3 2.40GHz, 1 CPU, 2 logical and 2 physical cores
.NET Core SDK=3.1.201
[Host] : .NET Core 3.1.3 (CoreCLR 4.700.20.11803, CoreFX 4.700.20.12001), X64 RyuJIT
MediumRun : .NET Core 3.1.3 (CoreCLR 4.700.20.11803, CoreFX 4.700.20.12001), X64 RyuJIT
Job=MediumRun Toolchain=.NET Core 3.1 IterationCount=15
LaunchCount=1 WarmupCount=10 1.11.5
| Type | Method | N | DataType | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|---|
| Compilation | Template | ? | ? | 38,094,313.9 ns | 1,115,210.08 ns | 988,604.69 ns | 307.6923 | 153.8462 | - | 5858226 B |
| EndToEnd | Default | 5 | dictionary | 3,874,438.3 ns | 47,403.74 ns | 39,584.27 ns | 70.3125 | - | - | 1159649 B |
| EndToEnd | Default | 5 | object | 3,860,625.3 ns | 130,069.50 ns | 115,303.22 ns | 66.4063 | - | - | 1082011 B |
Current
| Type | Method | N | DataType | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|---|
| Compilation | Template | ? | ? | 19,088,174.6 ns | 260,500.05 ns | 243,671.91 ns | 31.2500 | - | - | 843775 B |
| EndToEnd | Default | 5 | dictionary | 247,534.3 ns | 3,965.39 ns | 3,515.22 ns | 2.6855 | - | - | 52824 B |
| EndToEnd | Default | 5 | object | 268,289.3 ns | 2,915.08 ns | 2,584.14 ns | 2.4414 | - | - | 52827 B |
Contributors
@zjklee
1.11.5
Changes
-
Minor improvements to path handling and access @alexdawes (#333)
Ensure that path breaking respects square bracket escape characters so that objects with keys like
foo.barcan be accessed using{{ [foo.bar] }}(#328)Give preference to string index property getters if one exists, to avoid classes that implement
IEnumerable<object>whilst also having a string indexer (most notablyJObject) from being unable to be used with numeric keys. (#329)Only trim a single pair of square brackets from the key, and only if both exist (
[at start of key and]at end) -
#243: Support
@lastfor properties enumeration @zjklee (#330)The PR adds support for
@lastproperty for properties enumeration.
Originally raised in #243 issue. -
Literals should be the correct type when passed as arguments to helpers @pmccloghrylaing (#319)
Closes #298
-
Added tests and improved allocations for HtmlEncoder @304NotModified (#313)
As the HtmlEncoder is an important thing when rendering, I added some tests for the coverage and improved the allocations, no need to allocate a stringbuilder and new string if no encoding needs to be done :)
-
Added support for implicit interface implementation for dictionaries @304NotModified (#315)
Fixes #239
-
Added XML docs to NuGet package @304NotModified (#312)
Maybe there isn't much XML docs in the package, but now it's more useful as users will see the XML docs when using the API ;)
-
Added NuGet badge @304NotModified (#311)
Added NuGet badge which shows the latest version number
-
Added sample helper unit test for conditional if @hungquach (#234)
Contributors
@304NotModified, @Magentaize, @alexdawes, @el2iot2, @hmflash, @hungquach, @huysentruitw, @jchannon, @jokin, @lacutah, @leekelleher, @leniency, @lot224, @mikeprince3, @mohd-akram, @nblumhardt, @pmccloghrylaing, @rexm, @sganz, @stephengeorgewest-navitaire, @uffebjorklund, @vzwick, @zjklee
v1.9.0
Get the binaries via NuGet:
nuget install Handlebars.Net
Version 1.9.0 is a significant update that includes the following:
- Support for .NET Standard 1.3, as well as back compatibility to .NET 4.0
- Lots of fixes for parsing edge cases, complex paths and arguments
- Better troubleshooting support with clearer exception messages
Big thanks to @jchannon, @devlead, @axelheer, @vzwick, @asiffermann, @StefH, @Andrew-Hanlon, @SimonCropp, @abraham-fox, @katavasha, @JvanderStad, @EBMike, and @mikeofireland for their contributions and helping modernize Handlebars.Net!
v1.2
Version 1.2 includes a number of bug fixes, performance improvements, and new features:
- Support for
@rootcontext variable elseblocks can be used inside any helper, not just the built-in ones!- Ability to inject a custom path resolver
- And more...
Get the binaries via NuGet:
nuget install Handlebars.Net