Releases: JPVenson/morestachio
Releases · JPVenson/morestachio
Removal of obsolete code, QOL features, Bugfixes
- Removed the
#IFELSE
keyword - Changed the
#ELSE
keyword so that it has the be written as a child of an#IF
keyword. See https://github.com/JPVenson/morestachio/wiki/Keywords#else - Changed the behavior of the
IfDocumentItem
and added theInverted
property so it can replace theIfNotDocumentItem
- Added the
#ELSEIF
keyword as an conditional else within an#IF
keyword. See https://github.com/JPVenson/morestachio/wiki/Keywords#else - Removed the obsolete
.()
ToString formatter. This is possibly a breaking change if you did not update your formatter calls earlier. Just insert.ToString()
to get the same behavior - Reduced XML serialization size for partial documents
- Fixed:
/DECLARE
tags would not be correctly reconstructed using theToParsableStringDocumentVisitor
- Added
ParserOptions.UnmatchedTagBehavior
- Added
$services
variable for direct access to services instances from template - Added Optional
FileSystemService
for direct file access from within the template
Expression overhaul
This mayor release contains a mayor rewrite of the expression parser, adding an tokenizer that greatly simplifies the tokenizing and parsing steps for expressions. This also results in a 20% performance improvement in small-medium sized expressions (<500 chars) but is slower for larger expressions. It also fixes a lot of bugs with the experimental operator feature and adds brackets for expressions.
- Added predefined Path formatter
- allows brackets in expressions
- Added AsObject formatter to convert IDictionary<string, object> into c# objects
- Added null placeholder update within template by setting the $null variable:
{{#var $null = 'DD'}}
- Added Expression tokenizer and parser
this is an pre-release as there will be some performance improvements but it should be considered production ready.
Hotfix
Instance formatters, Raw Escaping blocks, #Scope keyword and bugfixes
- Morestachio can now link instance methods attributed with the
[MorestachioFormatter]
- Breaking change: removed support for options "TokenPrefix" & "TokenSuffix"
- Added Escaping blocks. Everything within
{{!?}} ... {{/!?}}
block is treated as raw content and is exempt from parsing - Added Inline escaping. A token prefixed with
{{?= ...}}
is treated as raw content and is exempt from parsing - Fixed a NREX when accessing an variable that does not exist
- Fixed the Inverted IF block not setting it context right
- Updated the internal workings of block closing deserialization so more information is preserved for recombination of a template
- Depricated the
{{#PATH}} {{/PATH}}
scoping syntax and replaced it with an explicit keyword#SCOPE
. Please update your templates to use the{{#SCOPE path}} ... {{/SCOPE}}
syntax. This version does still support the#PATH
syntax. - Removed support for R# attributes
- Added the TrimAll prefix and suffix
--|
and|--
- Added Tag&Block base classes that support
Regex
for tokenizing- BlockRegexDocumentItemProviderBase
- TagRegexDocumentItemProviderBase
- Breaking change: Added the ParserOptions argument for all
IPartialStore
methods - Added Build-In console logger implementation
- Added Build-In FileSystem backed PartialStore
- Added additional formatters
- Inflect
- ByteStorageHumanzier
Bugfixes
Bugfixes, Whitespace Control, Custom Template Containers
- Added missing ToParsableStringVisitor Implementation for
#Switch
,#Case
,#Default
blocks - Changed the Implementation of the
Substring
formatter to be more lenient in handling out of bounds arguments - Added the
MorestachioFormatterService.ExceptionHandling
property. It controls what should happen when a formatter throws an exception. - Added Delegate compilation. All
IDocumentItem
s can implement theISupportCustomCompilation
interface. This is a WIP feature but fully tested. Expect changes to that comming. - Fixed Locations in all DocumentItems to be correctly reported now
- Fixed
#LOC
,#LOCCULTURE
and#LOCP
tags&blocks to be case insensitive now - Fixed
$Name
&$recursion
variables for Partials to be correctly reported when nesting Partials - Fixed a
NullReferenceException
when invoking an Operator that is not declared - Added
bool.Not(bool value)
formatter as an alias for thebool.Negate(bool value)
formatter - Moved the
IEnumerable<T>.Take<T>(IEnumerable<T> source, Number items)
and theIEnumerable<T>.Skip<T>(IEnumerable<T> source, Number items)
formatters from theDynamicLinq
package to the predefinedLinqFormatter
as they do not require the externalSystem.Dynamic.Linq
package - Fixed string not parsing when the last argument at root expression
- Fixed nested
#IF
calls can effect outside#ELSE
blocks - Fixed Scopeing in Import
- Added NullCoalescing Operator
- Fixed Serialization for
#CULTURE
,#LOC
and#LOCP
- Added
ITemplateContainer
. This container can be set to provide a template from a source other then a string in memory like from a stream directly in a Low-Memory case - Fixed Expression not Compiling correctly when using self assignment and formats
- Fixed Inverted Scope not be rendered by the ToParsableStringDocumentVisitor
- Fixed bug where multithreadded use of MemoryTranslationResource could cause errors
- Fixed Several bugs in DocumentVisitor and Expression Visitor
- Added
Get(object value, string path)
formatter to dynamicly get an value from an object in the same way as Morestachio does - Added ScopeData as addable service
- Added Logger interface and Logger Formatter
Log(string category, string eventId, string message)
- Added
--|
and|--
prefix and suffix whitespace control to replace the old behavior of-|
and|-
. Both old whitespace control operators will now only remove all whitespaces until they encounter the first linebreak.
Switch-Case and Import
- Added
#Switch #case #default
keywords (https://github.com/JPVenson/morestachio/wiki/Keywords#switch-casedefault) - Added Parse-Time option for TrimTailing and TrimLeading (https://github.com/JPVenson/morestachio/wiki/Keywords#set-option)
- Fixed Html formatter not added per default to ContextObject
- Fixed wrong location reporting in DocumentItems
- Fixed a bug where Numbers could not be compared to anything else then numbers
- Added the Option to write multiple expressions inline behind each others by seperating them with
;
- Added
#Import
keyword (https://github.com/JPVenson/morestachio/wiki/Keywords#partials)
In-Keyword Whitespace control and bugfixes
- Fixed possible NullReferenceException in
MorestachioFormatterService
- Added additional Number methods
- Fixed Formatter not been called in certain situations (generics)
- Added in-keyword whitespace&newline trimming be prefixing
{{-|
and/or suffixing|-}}
Bugfix
Bugfix and QOL features
This release contains a number of QOL features, additions to the Operator logic and some Bugfixes
- Prepared Multipart streams for future parallel template processing
- Added Fluent Api. This allows the direct modfication or creation of templates with cs code
- Refactored Project structure (This may introduce breaks in using declarations)
- Updated DynamicLinq formatter names (The old legacy lower case names are still provided)
- Removed now obsolete Kind property from IDocumentItem
- Added the Option to obtain all variables set within the template for bidirectional communication from your code to the template and back
- Added at lot new pre definied formatters
- Several Performance changes
- Changed the ParserOptions to be of
ISealed
to prevent modifications after the template was begin to render - Added Build-In Optional support for Translations via the
ParserOptions.RegisterLocalizationService()
extension method - Added Block comments in template
{{!}} comment {{/!}}
- Added the
{{#SET OPTION name = value}}
tag to allow for options setting from the template in parsing time- Added Option
TokenPrefix
- Added Option
TokenSuffix
- See https://github.com/JPVenson/morestachio/wiki/Keywords#set-option
- Added Option
- Added Support for
ICustomTypeDescriptor
directly
Bugs:
- Fixed bug where Numbers on non EN systems are not correctly parsed
- Fixed experimental Operators bug where GreaterThen and LessThen was switched
- Fixed experimental Operators bug where chained operators where not detected properly