mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 17:15:28 +08:00 
			
		
		
		
	Add generated Emoji class with corresponding non-generated file
This commit is contained in:
		 Kristian Hellang
					Kristian Hellang
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						Patrik Svensson
					
				
			
						parent
						
							0632b38477
						
					
				
				
					commit
					fea8a36e8a
				
			
							
								
								
									
										1843
									
								
								src/Spectre.Console/Emoji.Generated.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1843
									
								
								src/Spectre.Console/Emoji.Generated.cs
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										23
									
								
								src/Spectre.Console/Emoji.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/Spectre.Console/Emoji.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | using System.Text.RegularExpressions; | ||||||
|  |  | ||||||
|  | namespace Spectre.Console | ||||||
|  | { | ||||||
|  |     /// <summary> | ||||||
|  |     /// Utility class for working with emojis. | ||||||
|  |     /// </summary> | ||||||
|  |     internal static partial class Emoji | ||||||
|  |     { | ||||||
|  |         private static readonly Regex _emojiCode = new Regex(@"(:(\S*?):)", RegexOptions.Compiled); | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Replaces emoji markup with corresponding unicode characters. | ||||||
|  |         /// </summary> | ||||||
|  |         /// <param name="value">A string with emojis codes, e.g. "Hello :smiley:!".</param> | ||||||
|  |         /// <returns>A string with emoji codes replaced with actual emoji.</returns> | ||||||
|  |         public static string Replace(string value) | ||||||
|  |         { | ||||||
|  |             static string ReplaceEmoji(Match match) => _emojis[match.Groups[2].Value]; | ||||||
|  |             return _emojiCode.Replace(value, ReplaceEmoji); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -20,6 +20,9 @@ | |||||||
|     <Compile Update="Border.*.cs"> |     <Compile Update="Border.*.cs"> | ||||||
|       <DependentUpon>Border.cs</DependentUpon> |       <DependentUpon>Border.cs</DependentUpon> | ||||||
|     </Compile> |     </Compile> | ||||||
|  |     <Compile Update="Emoji.*.cs"> | ||||||
|  |       <DependentUpon>Emoji.cs</DependentUpon> | ||||||
|  |     </Compile> | ||||||
|     <Compile Update="Extensions/AnsiConsoleExtensions.*.cs"> |     <Compile Update="Extensions/AnsiConsoleExtensions.*.cs"> | ||||||
|       <DependentUpon>Extensions/AnsiConsoleExtensions.cs</DependentUpon> |       <DependentUpon>Extensions/AnsiConsoleExtensions.cs</DependentUpon> | ||||||
|     </Compile> |     </Compile> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user