| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="TextTemplating.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | |
| | | 9 | | namespace MyNet.Text.Templating; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// Provides access to text templating utilities, such as sanitizers and transformers. |
| | | 13 | | /// </summary> |
| | | 14 | | public static class TextTemplating |
| | | 15 | | { |
| | | 16 | | /// <summary> |
| | | 17 | | /// Gets a sanitizer suitable for file names. |
| | | 18 | | /// </summary> |
| | 0 | 19 | | public static ITemplateTransform Default { get; } = new TemplateTransform(new()); |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Creates a new template transform with the specified configuration. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <param name="configure">An action to configure the text template options.</param> |
| | | 25 | | /// <returns>A new template transform instance.</returns> |
| | | 26 | | public static ITemplateTransform Create(Action<TextTemplateOptionsBuilder> configure) |
| | | 27 | | { |
| | 36 | 28 | | var builder = new TextTemplateOptionsBuilder(); |
| | 36 | 29 | | configure(builder); |
| | 36 | 30 | | return new TemplateTransform(builder.Build()); |
| | | 31 | | } |
| | | 32 | | } |
| | | 33 | | |