- Fixed: #179 DualFromZeroToTwo plural rule. Thanks to @OhSoGood
- Fixed: #211 Illegal placeholder characters that are not 8-bit, will no more throw unexpected
ThrowByteOverflowException. Thanks to @bogatykh
- Fixed broken backward compatibilty introduced in v2.6.2 (issues referenced in #148, #147, #143).
- Fixed: Take an erroneous format string like
"this is {uncomplete"(missing closing brace). Before v2.7.0 the parser handled{uncompleteas aTextLiteral, not as an erroneousPlaceholder. - Fixed: Since v1.6.1 there was an undiscovered issue: If the
Parserencountered aParsingError.TooManyClosingBraces, this closing brace was simply "swallowed-up". This way, the result withParser.ErrorAction.MaintainTokensdiffers from the original format string. From v2.7.0, the redundant closing brace is handled as aTextLiteral. - Improved: For
ParsingError.TrailingOperatorsInSelectorandParsingError.InvalidCharactersInSelectorthe causing character is now included in theException.Message. - If you have issues formatting HTML with CSS and/or JavaScript included, please read the bullet-proof How-to in the Wiki
- Fix: Fully implemented all
Settings.ParseErrorAction, see #143 - Thanks to Anders Jonsson
- Fixed #136
- Upgraded test project to netcoreapp3.1
- Enhanced SubString extension as described in PR142 - Thanks to Anders Jonsson
- Migrated project with Nullable Reference Types (NRT) enabled
Bugfix: ListFormatter will now process IList data sources only.
Supported frameworks now are:
- .Net Framework 4.6.1, 4.6.2, 4.7.2 and 4.8 (
System.Text.Jsonis not supported for .Net Framework 4.5.x and thus had to be dropped) - .Net Standard 2.0 and 2.1
- Added
System.Text.Json.JsonElementto the JsonSource extension.Newtonsoft.Jsonis still included. - Added a demo version as a netcoreapp3.1 WindowsDesktop App
- Supported framworks now are:
- .Net Framework 4.6.2, 4.7.2 and 4.8 (
System.Text.Jsonis not supported for .Net Framework 4.5.x and thus had to be dropped) - .Net Standard 2.0 and 2.1
- .Net Framework 4.6.2, 4.7.2 and 4.8 (
- Updated the Wiki
Sources
- New: Added
ValueTupleSourceforValueTuples - Changed:
SmartObjectsandSmartObjectsSourceare depreciated in favor ofValueTupleSource
Settings
- Breaking Change: Internal string comparisons (i.e. for placeholder names) are no more culture-specific, but
OrdinalorOrdinalIgnoreCaserespectively. See discussion under this issue. - Breaking Change: Default
ErrorActionis nowThrowErrorfor parser and formatter, instead ofIgnore
Other
- Changed: Removed all members which were flagged obsolete since more than a year.
Fixed an issue with SmartObjects
TimeFormatter
- New: Supports DateTimeOffset as parameter
- Changed in v2.4.1:
DateTimeoperations always use their Universal Time representation. (Before, in case aDateTimehad propertyKindset toDateTimeKind.Unspecified, the result of a comparison was ambiguous.) - CTOR TimeFormatter(languageCode) throws for not implemented languageCode
- CTOR TimeFormatter() is obsolete (redundant)
- Obsolete in TimeSpanUtility
- TimeSpan extension method Floor (redundant)
- TimeSpan extension method Ceiling (redundant)
ConditionalFormatter
- New: Supports DateTimeOffset as parameter
- Changed:
DateTimeoperations always use their Universal Time representation. (Before, in case aDateTimehad propertyKindset toKind.Unspecified, the result of a comparison was ambiguous.)
Demo
- Updated with DateTimeOffset example
- Updated with TimeFormatter example
- Added SubStringFormatter thanks to arilani
- Improved code coverage in unit tests
- Updated dependencies
- As announced: Dropped support for .NET 4.0, which was released back in 2010.
- Support for JSON Objects as data source
- Added IsMatchFormatter thanks to ericpyle
- Fixes issue with unsigned integers #101
- This is the last version supporting .NET 4.0, which was released back in 2010.
- Fixes issue #101
- This version includes a breaking change:
- Before:
OnParsingFailureevent was invoked after each parsing error - Now:
OnParsingFailureevent is invoked after parsing is completedParsingErrorEventArgshas a different signature. It now includes allParsingErrorswith all details that would be supplied during a parser exception. This also includes messages indicating where there the parse error occurred.
- Before:
- Fixes issue #94
- Characters Literals in Format Strings
- Improved working with several data sources: SmartObjects
- Changes in SmartSettings
- Fixed signing assemblies
- ReflectionSource now also gets members from base classes
- Added nesting and list tests
- Added coding samples
- Improved source xml docs
- Extended Wiki documentation for error handling and common pitfalls
- No more ambiguity between named formatters and string.Format formatting arguments: The parser checks whether the parsed name exists in one of the formatter extensions.
- SmartFormatter and Parser default to ErrorAction = ErrorAction.Ignore in release AND debug mode
- SmartFormatter has EventHandler OnFormattingFailure
- Parser has EventHandler OnParsingFailure
- Obsolete FormatItem.Text property removed (was replaced by RawText property some time ago)
- Assemblies are signed with a strong name key file
- Supported frameworks are .Net 4.0, .Net 4.5, .Net Core - dropped .Net 3.5 and earlier
- Added an icon to the nuget package
- Fixed issue with parsing named formatter options (#45)
- Minor changes to the Extensions API:
- Added fields to
ISelectorInfo - Made
Textobsolete in favor ofRawText.
- Added
TemplateFormatter. Allows you to register named templates, to be used within other templates.
Note: the TemplateFormatter extension is not a default extension, and must be added manually.
- Added "Nested Scopes" feature. This allows a nested template to
easily access outer scopes, without tricky workarounds.
For example: in"{Person: {Address: {City} {FirstName} } }",{City}will come fromAddress, but{FirstName}will come fromPerson.
This will work especially well with conditional formatting!
- Massive improvements to the Extension API. Code is cleaner and easier to use.
- Breaking changes: Any custom Extensions will need to be updated to match the new API.
Long story short, instead of 5 parameters passed toIFormatter.EvaluateFormat, it now just gets a singleFormatterInfoargument that contains all parameters. - Added the "choose" formatter, to eventually replace the ConditionalFormatter.
Hopefully it's self explanatory with these usage examples:
"{0:choose(1|2|3):one|two|three|default}"works like a switch statement"{0:choose(null):nothing|{something}}"can do null checking"{Gender:choose(Male|Female):his|her}"works great with Enums
- Added "Named Formatters", which allows you to use a
specific formatter by specifying its name.
For example, "{0:plural: ___ }" will use the Plural formatter, and "{0:default: ___ }" will use the default formatter. - Added "Formatter Options", which allows you to specify options
for a named formatter. This will be used in the near future.
For example, "{0:name(options): ___ }"
- Added .NET v3.5 and .NET v4.0 builds
- Added "releases" folder to hold official releases
- Added
UseAlternativeBracesmethod, so that templates can use alternative characters - Added
SmartFormatter.GetFormatterExtensionandGetSourceExtensionmethods, which can be used to configure extensions - Added
DefaultTwoLetterISOLanguageNameproperties to theTimeSpanFormatterandPluralLocalizationFormatter - Fixed
AddExtensionsto insert new extensions before existing ones (otherwise, it's pretty useless) (#17)
Converted from "CustomFormat" (VB.NET)