crozone / FormatWith

String extensions for named parameterized string formatting.
MIT License
73 stars 13 forks source link

Additional formatting options. #27

Open crozone opened 3 years ago

crozone commented 3 years ago

As FormatWith gains features, additional options to control how formatting is performed will be required.

Control over disabling property and indexer navigations.

Property navigations, and soon indexers (https://github.com/crozone/FormatWith/issues/26), are supported in property keys. In these situations, FormatWith will use reflection to introspect the input object and retrieve the required value.

However, a use-case for FormatWith is handling untrusted string inputs. For security reasons, it is desirable to be able to disable these features so that unstrusted inputs cannot navigate to properties that are not anticipated.

Additional templating formats

We may want to support additional templating styles and formats, such as multi-character start and end brackets (https://github.com/crozone/FormatWith/issues/24), or formats like mustache.js (https://github.com/crozone/FormatWith/issues/11). Selecting which format is desired will necessarily require another configuration option.

Options object

As FormatWith grows in complexity it will be desirable to encapsulate the format options into a dedicated object/struct and pass it in as a dedicated parameter, in order to reduce the number of parameters that .FormatWith() is called with.

Parameters like the openBraceChar and closeBraceChar would be rolled into this object.