mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Parsing
This commit is contained in:
		
							parent
							
								
									921baf66cb
								
							
						
					
					
						commit
						5b3251ab59
					
				
					 1 changed files with 50 additions and 42 deletions
				
			
		|  | @ -380,12 +380,15 @@ namespace AideDeJeuCmd | |||
|         } | ||||
| 
 | ||||
|         static async Task ExtractHtmlAsync() | ||||
|         { | ||||
|             for (int i = 1; i <= 434; i++) | ||||
|             { | ||||
|                 var parser = new HtmlParser(); | ||||
|                 var doc = new HtmlAgilityPack.HtmlDocument(); | ||||
|             doc.Load(@"..\..\..\..\..\Ignore\tome_of_beasts\page30.html"); | ||||
|                 doc.Load($@"..\..\..\..\..\Ignore\tome_of_beasts\page{i}.html"); | ||||
|                 parser.OutputMarkdown(parser.Parse(doc)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         class HtmlParser | ||||
|         { | ||||
|  | @ -425,6 +428,8 @@ namespace AideDeJeuCmd | |||
|                 var txtDivs = doc.DocumentNode.SelectNodes("//div[@class='txt']"); | ||||
|                 var fullText = new FullText(); | ||||
|                 var fullLine = new FullLine(); | ||||
|                 if (txtDivs != null) | ||||
|                 { | ||||
|                     foreach (var txtDiv in txtDivs) | ||||
|                     { | ||||
|                         var spans = txtDiv.Elements("span"); | ||||
|  | @ -469,6 +474,7 @@ namespace AideDeJeuCmd | |||
|                         } | ||||
|                     } | ||||
|                     fullText.Add(fullLine); | ||||
|                 } | ||||
| 
 | ||||
|                 return fullText; | ||||
|             } | ||||
|  | @ -509,17 +515,19 @@ namespace AideDeJeuCmd | |||
|                         } | ||||
|                         else if (keySpan.IdStyle.Contains("font-family:sans-serif; font-weight:normal; font-style:normal;")) | ||||
|                         { | ||||
|                             Console.Write($"{keySpan.Text} {value}"); | ||||
|                             Console.ForegroundColor = ConsoleColor.Red; | ||||
|                             Console.Write($"{keySpan.Text}"); | ||||
|                             Console.ForegroundColor = ConsoleColor.White; | ||||
|                             Console.WriteLine($" {value}"); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             //Console.Write($"{spanStyle} => {span.InnerText} "); | ||||
|                             Console.Write($"{keySpan.Text} {value}"); | ||||
|                             Console.ForegroundColor = ConsoleColor.Red; | ||||
|                             Console.Write($"{keySpan.Text}"); | ||||
|                             Console.ForegroundColor = ConsoleColor.White; | ||||
|                             Console.WriteLine($" {value}"); | ||||
|                         } | ||||
|                         //Console.Write(spa.Text); | ||||
|                     } | ||||
|                     Console.WriteLine(); | ||||
|                     //Console.WriteLine(); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez