mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Correction parsing rituel/ritual
This commit is contained in:
		
							parent
							
								
									c6d9f99c77
								
							
						
					
					
						commit
						6b35d38513
					
				
					 4 changed files with 61 additions and 55 deletions
				
			
		|  | @ -36,7 +36,7 @@ namespace AideDeJeuLib.Spells | ||||||
|                     { |                     { | ||||||
|                         System.Diagnostics.Debug.WriteLine(value); |                         System.Diagnostics.Debug.WriteLine(value); | ||||||
|                         //re = new Regex("level (?<level>\\d) - (?<type>.*?)\\w?(?<rituel>\\(ritual\\))?"); |                         //re = new Regex("level (?<level>\\d) - (?<type>.*?)\\w?(?<rituel>\\(ritual\\))?"); | ||||||
|                         re = new Regex("(?<level>\\d) - (?<type>.*)\\w?(?<rituel>\\(ritual\\))?"); |                         re = new Regex("^(?<level>\\d) - (?<type>.*?)\\s?(?<rituel>\\(ritual\\))?$"); | ||||||
|                         match = re.Match(value); |                         match = re.Match(value); | ||||||
|                         this.Type = match.Groups["type"].Value; |                         this.Type = match.Groups["type"].Value; | ||||||
|                         this.Level = match.Groups["level"].Value; |                         this.Level = match.Groups["level"].Value; | ||||||
|  |  | ||||||
|  | @ -478,61 +478,67 @@ namespace AideDeJeu.Tools | ||||||
|             var str = string.Empty; |             var str = string.Empty; | ||||||
|             foreach (var inline in inlines) |             foreach (var inline in inlines) | ||||||
|             { |             { | ||||||
|                 //Debug.WriteLine(inline.GetType()); |                 str += inline.ToMarkdownString(); | ||||||
|                 string add = string.Empty; |  | ||||||
|                 if (inline is Markdig.Syntax.Inlines.LineBreakInline) |  | ||||||
|                 { |  | ||||||
|                     add = "\n"; |  | ||||||
|                 } |  | ||||||
|                 else if (inline is Markdig.Syntax.Inlines.LiteralInline) |  | ||||||
|                 { |  | ||||||
|                     var literalInline = inline as Markdig.Syntax.Inlines.LiteralInline; |  | ||||||
|                     add = literalInline.Content.ToString(); |  | ||||||
|                 } |  | ||||||
|                 else if (inline is Markdig.Syntax.Inlines.EmphasisInline) |  | ||||||
|                 { |  | ||||||
|                     var emphasisInline = inline as Markdig.Syntax.Inlines.EmphasisInline; |  | ||||||
|                     var delimiterChar = emphasisInline.DelimiterChar.ToString(); |  | ||||||
|                     if (emphasisInline.IsDouble) |  | ||||||
|                     { |  | ||||||
|                         delimiterChar += delimiterChar; |  | ||||||
|                     } |  | ||||||
|                     add = delimiterChar + emphasisInline.ToMarkdownString() + delimiterChar; |  | ||||||
|                 } |  | ||||||
|                 else if (inline is Markdig.Syntax.Inlines.LinkInline) |  | ||||||
|                 { |  | ||||||
|                     var linkInline = inline as Markdig.Syntax.Inlines.LinkInline; |  | ||||||
|                     add = string.Empty; |  | ||||||
|                     if (linkInline.IsImage) |  | ||||||
|                     { |  | ||||||
|                         add = "!"; |  | ||||||
|                     } |  | ||||||
|                     var label = linkInline.ToMarkdownString(); |  | ||||||
|                     var url = linkInline.Url; |  | ||||||
|                     var title = linkInline.Title; |  | ||||||
|                     if (!string.IsNullOrEmpty(title)) |  | ||||||
|                     { |  | ||||||
|                         add += string.Format($"[{label}]({url} \"{title}\")"); |  | ||||||
|                     } |  | ||||||
|                     else |  | ||||||
|                     { |  | ||||||
|                         add += string.Format($"[{label}]({url})"); |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|                 else if (inline is Markdig.Syntax.Inlines.ContainerInline) |  | ||||||
|                 { |  | ||||||
|                     var containerInline = inline as Markdig.Syntax.Inlines.ContainerInline; |  | ||||||
|                     add = containerInline.ToMarkdownString(); |  | ||||||
|                 } |  | ||||||
|                 else |  | ||||||
|                 { |  | ||||||
|                     add = inline.ToString(); |  | ||||||
|                 } |  | ||||||
|                 //Debug.WriteLine(add); |  | ||||||
|                 str += add; |  | ||||||
|             } |             } | ||||||
|             return str; |             return str; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         public static string ToMarkdownString(this Markdig.Syntax.Inlines.Inline inline) | ||||||
|  |         { | ||||||
|  |             //Debug.WriteLine(inline.GetType()); | ||||||
|  |             string add = string.Empty; | ||||||
|  |             if (inline is Markdig.Syntax.Inlines.LineBreakInline) | ||||||
|  |             { | ||||||
|  |                 add = "\n"; | ||||||
|  |             } | ||||||
|  |             else if (inline is Markdig.Syntax.Inlines.LiteralInline) | ||||||
|  |             { | ||||||
|  |                 var literalInline = inline as Markdig.Syntax.Inlines.LiteralInline; | ||||||
|  |                 add = literalInline.Content.ToString(); | ||||||
|  |             } | ||||||
|  |             else if (inline is Markdig.Syntax.Inlines.EmphasisInline) | ||||||
|  |             { | ||||||
|  |                 var emphasisInline = inline as Markdig.Syntax.Inlines.EmphasisInline; | ||||||
|  |                 var delimiterChar = emphasisInline.DelimiterChar.ToString(); | ||||||
|  |                 if (emphasisInline.IsDouble) | ||||||
|  |                 { | ||||||
|  |                     delimiterChar += delimiterChar; | ||||||
|  |                 } | ||||||
|  |                 add = delimiterChar + emphasisInline.ToMarkdownString() + delimiterChar; | ||||||
|  |             } | ||||||
|  |             else if (inline is Markdig.Syntax.Inlines.LinkInline) | ||||||
|  |             { | ||||||
|  |                 var linkInline = inline as Markdig.Syntax.Inlines.LinkInline; | ||||||
|  |                 add = string.Empty; | ||||||
|  |                 if (linkInline.IsImage) | ||||||
|  |                 { | ||||||
|  |                     add = "!"; | ||||||
|  |                 } | ||||||
|  |                 var label = linkInline.ToMarkdownString(); | ||||||
|  |                 var url = linkInline.Url; | ||||||
|  |                 var title = linkInline.Title; | ||||||
|  |                 if (!string.IsNullOrEmpty(title)) | ||||||
|  |                 { | ||||||
|  |                     add += string.Format($"[{label}]({url} \"{title}\")"); | ||||||
|  |                 } | ||||||
|  |                 else | ||||||
|  |                 { | ||||||
|  |                     add += string.Format($"[{label}]({url})"); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             else if (inline is Markdig.Syntax.Inlines.ContainerInline) | ||||||
|  |             { | ||||||
|  |                 var containerInline = inline as Markdig.Syntax.Inlines.ContainerInline; | ||||||
|  |                 add = containerInline.ToMarkdownString(); | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 add = inline.ToString(); | ||||||
|  |             } | ||||||
|  |             //Debug.WriteLine(add); | ||||||
|  |             return add; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         public static string ToMarkdownString(this Markdig.Syntax.ParagraphBlock paragraphBlock) |         public static string ToMarkdownString(this Markdig.Syntax.ParagraphBlock paragraphBlock) | ||||||
|         { |         { | ||||||
|             var str = string.Empty; |             var str = string.Empty; | ||||||
|  |  | ||||||
|  | @ -132,7 +132,7 @@ namespace AideDeJeu.ViewModels | ||||||
|                         spell.Type.ToLower().Contains(ecole.ToLower()) && |                         spell.Type.ToLower().Contains(ecole.ToLower()) && | ||||||
|                         spell.Source.Contains(source) && |                         spell.Source.Contains(source) && | ||||||
|                         spell.Source.Contains(classe) && |                         spell.Source.Contains(classe) && | ||||||
|                         spell.Type.Contains(rituel) && |                         spell.Rituel.Contains(rituel) && | ||||||
|                         Helpers.RemoveDiacritics(spell.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()); |                         Helpers.RemoveDiacritics(spell.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()); | ||||||
|                 }).OrderBy(spell => spell.NamePHB) |                 }).OrderBy(spell => spell.NamePHB) | ||||||
|                             .AsEnumerable(); |                             .AsEnumerable(); | ||||||
|  |  | ||||||
|  | @ -1499,7 +1499,7 @@ Si vous lancez ce sort à deux reprises ou plus avant un long repos, il y a 25 % | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Communion avec la nature | # Communion avec la nature | ||||||
| - NameVO: [Commune](spells_vo.md#commune) with Nature | - NameVO: [Commune with Nature](spells_vo.md#commune-with-nature) | ||||||
| - CastingTime: 1 minute | - CastingTime: 1 minute | ||||||
| - Components: V, S | - Components: V, S | ||||||
| - Duration: instantanée | - Duration: instantanée | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez