| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="Slugifier.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | namespace MyNet.Text.Slugification; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Provides common slugifier transforms. |
| | | 11 | | /// </summary> |
| | | 12 | | public static class Slugifier |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the default slugifier transform. |
| | | 16 | | /// </summary> |
| | 3 | 17 | | public static ITextSlugifierTransform Default { get; } = new SlugifyTransform(new()); |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets a kebab-case slugifier (lowercase, '-' separator). |
| | | 21 | | /// </summary> |
| | 3 | 22 | | public static ITextSlugifierTransform KebabCase { get; } = Default; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets a snake_case slugifier (lowercase, '_' separator). |
| | | 26 | | /// </summary> |
| | 3 | 27 | | public static ITextSlugifierTransform SnakeCase { get; } = new SlugifyTransform(new() { Separator = '_' }); |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets a slugifier preserving original case. |
| | | 31 | | /// </summary> |
| | 3 | 32 | | public static ITextSlugifierTransform PreserveCase { get; } = new SlugifyTransform(new() { Lowercase = false }); |
| | | 33 | | } |
| | | 34 | | |