Releases: JPVenson/morestachio
Enums, Performance and Global formatter
This release packs a lot of features and a lot of Performance optimizations .
Bugs:
- It is no longer possible to add an formatter with a name that is not invokable from a template
Features:
- Added a huge ammount of pre-defined formatters for common usage. See: https://github.com/JPVenson/morestachio/wiki/Predefined-Formatter
- Added WITH options for INCLUDE to specify the scope the INCLUDE should be executed with
- Added Support for distinct global formatters. These Formatters do not need an
SourceObject
and can be invoke anywhere - Added ##Let keyword
- Added Block&Tag-DocumentItemProvider for easy extension
- BREAKING CHANGE The FormatterService does no longer offer the option to enable case matching of name and now does this by default. If you need case insensitive matching please inhert from
MorestachioFormatterService
and implement your own matching logic - Numbers are now completely ParseTime and are now part of the expression itself with the
ExpressionNumber
- Updated Debugger Proxies
- Experimental Added support for Operators. Operators are a special kind of formatters and must be explicitly declared with the
[MorestachioOperatorAttribute]
- Added new Project:
Morestachio.Newtonsoft.Json
containing an Json IValueResolver - Added new Project:
Morestachio.Runner
that wraps theParse
andCreate
calls - Added new Project:
Morestachio.LessCompiler
containing an CustomDocumentItem
that can compile Less code- Supports JSON and .Net Dlls
- Changed from Task to ValueTask for .NetCore dlls
- Added Support for .NetCore3.1
- Added TextOperations
- Added NewLine Tag
{{#NL}}
- Added TrimNewLines/s Tags
{{#TNL}}
&{{#TNLS}}
- Added NewLine Tag
- BREAKING CHANGE The
FormatterFrameworkService
now operates in a more declarative way. Formatter calls should be Cached for reusage by Instead callingCallMostMatchingFormatter
you should now callPrepareCallMostMatchingFormatter
&Execute
and cache the result ofPrepareCallMostMatchingFormatter
. - Added Helper classes for Invoice Generation:
Worktime
&Money
Bugfix Release
A Small Bugfix release:
Bugs:
- Inverted scope did not accept an collection variable in certain cases
- The Linq package did declare invalid Formatter names
- In .Net Core the Unpack for tasks did not work
Features:
- Added Autocomplete and Syntax highlighting for the Editor project
- Removed unnessary c# references
- Moved all possible Linq methods into the base lib as default formatter
- Breaking Change Changed method names in Number.cs BiggerAs -> GreaterThen and SmallerAs -> SmallerThen
4.0.1
Breaking Changes:;
- Refactored PartialStackOverflowBehavior to be outside ParserOptions
- Refactored TokenType of TokenPair to be IComparable instead of the enum TokenType to support custom TokenTypes
Features:
- Added {{DO expression}} ... {{/DO}} loop
- Added {{WHILE expression}} ... {{/WHILE}} loop
- Added Visitor api to IExpression
- Added Visitor api to IDocumentItem
- Updated the Linq project to contain all known Linq Functions as Formatter
- Updated Number support. All numbers (either from Template or from data) are now convertable into a
Number
struct. - Added global Math functions for all kinds of numbers (see https://github.com/JPVenson/morestachio/wiki/Numbers,-null-and-booleans#numbers)
- Added Service injection into Formatter via the
[ExternalDataAttribute]
(see https://github.com/JPVenson/morestachio/wiki/Formatter#formatter-service-injection) - Added support for Numbers, boolean and null syntax on parse-time rather evaluation in render-time
- Updated error creation for Path evaluation on parse-time for more verbose path checking
Bugs:
- Fixed Undisposed stream when using the Stringify methods
Expression Framework
Morestachio has undergone a major rewrite in how Expressions are parsed. It now offers the ExpressionTokenizer to parse single expressions that can be ether a Morestachio conform string (a string that starts with ether " or ' and ends with the same char that it started) or an expression.
3.0.0
In this release the new Formatter syntax is finalized, multible new language features where added and bugs
- Performance improvements for long paths
- Added support for Custom Document Items
- [Breaking Change] Removed support for old Formatter syntax
- Support for null values
- Support for template variables
- Support for Invariant formatter name lookup
Fluent Formatters
In this release a breaking change with the formatters will be introduced. Formatters should now be called as part of the path they are invoked.
- Removed the FormatterMatcher and replaced it with a new Version of the MorestachioFormatterService
- Besides its still possible to call formatters without an name, its recommanded to name any formatter accordingly to a Cs name
- Numbers in Templates are nativ supported. Write {{123}} to get an Int32, or use it as part of an formatter argument
- PartialStores allow precompiling certain partials and add them to an execution
- ValueConverters can intercept an call to an Formatter and allow custom conversion
- Keyword: IF & ELSE. Will only print its enclosing content it the expression results to the DefinitionOfTrue but will not set its scope to the result
- Added XML DocumentTree Serialization support
- Fixed #3
- Fixed #6
IF-NotIF, Several Formatter Fixes, NetStandard & DocumentTree
In this Release are several improvements to Morestachio.
- Morestachio is now a NetStandard Lib supporting following Frameworks: netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;net46;net461;net462;net47;net471;net472;
- There is an DocumentTree that will be returned by the Parser an can be Serialized
- Several changes to the Formatter Syntax. All string arguments must be now escaped with ether " or ' and everything else is treated as an Expression.
- Several fixes to the Formatters
- Linebreaks and Tabs in and at the start/end of Expressions are now allowed
- Custom Value resolvers were added to allow custom resolving from any object on a Global and/or per use case
- New Syntax If and NotIf
Partials and .Net Core versions
In this release it is now possible to create Partials by declaring them with
{{#declare NAME}} Just your usual {{code}} {{/declare}} <-- this declares the partial
{{#include NAME}} <-- this prints the Partial on this place and in this scope
- It is now possible to format scopes with
{{#path.to()}} {{/path.to()}}
- it is now possible to format inverted scopes with
{{^path.to()}} {{/path.to()}}
- It is now possible to enumerate (or box) objects into a list with
{{#each root.object.?}} {{Key}} {{Value}} {{/each}}
This will make every object usable by a#each
.
a. For c# objects Key is the name of the Property and Value is value
b. For Lists this will enumerate the list object NOT its items
c. For DictionaryKey
is Key andValue
is Value - Removed all references for cleanup ( only System.dll, Microsoft.CSharp and JetBrains.Annotations remains)
- Timeout added
- .Net Core and .Net Framework versions added ( both Morestachio code and Tests )
- Added Keyword
$recursion
that emits the level of recursion any partial is currently in - Added Limit of recursion (defaults to 255) in
ParserOptions
Formatter Framework Ex
In this release there are several changes to the old Mustachio. This is the first "official" release of Morestachio that differs from mustachio.
Summery:
- each value can be formatted by adding formatter the the morestachio
- Templates will be parsed as streams and will create a new stream. This is better when creating larger templates and best for web as you can also limit the length of the "to be" created template to a certain size
- Morestachio accepts any object besides the Dictionary<string,object> from mustachio.
- Root paths are supported, for examle
{{#this.is.a.object}} {{~this.is.from.root}} {{/this.is.a.object}}
- Cancellation of Template generation is supported
- Async calls are supported
- No Reference to Newtonsoft ( this has proven problematic with other versions of the lib )
- No Reference to System.Web ( Rewritten to WebUtility as
HttpUtility.HtmlEncode
just callsWebUtility.HtmlEncode
) - Using of JetBrains Annotations for R# user ( if you are not a R# user just ignore this point )
- Supports user Encoding of the result template
Note:
Releases contain ALL parts of Morestachio including (Morestachio, Morestachio.Formatter.Framework and Morestachio.Formatter.Framework.Linq). To get distinct packages please use the Nuget packages as seen on the Home.