1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00

Parsing table

This commit is contained in:
Yan Maniez 2018-06-12 18:52:30 +02:00
parent 9ba5c6dc30
commit 2ebd971309
3 changed files with 30 additions and 6 deletions

View file

@ -157,7 +157,7 @@ namespace AideDeJeu.Tools
//Console.WriteLine(spell.Name);
}
}
if (block is Markdig.Syntax.ParagraphBlock)
else if (block is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
actions.Add(paragraphBlock.ToParagraphString());
@ -169,7 +169,7 @@ namespace AideDeJeu.Tools
// spell.DescriptionHtml += "\n";
//}
}
if (block is Markdig.Syntax.ListBlock)
else if (block is Markdig.Syntax.ListBlock)
{
var listBlock = block as Markdig.Syntax.ListBlock;
//DumpListBlock(listBlock);
@ -260,6 +260,24 @@ namespace AideDeJeu.Tools
}
}
}
else if(block is Markdig.Extensions.Tables.Table)
{
var table = block as Markdig.Extensions.Tables.Table;
foreach(var blockrow in table)
{
var row = blockrow as Markdig.Extensions.Tables.TableRow;
foreach(var blockcell in row)
{
var cell = blockcell as Markdig.Extensions.Tables.TableCell;
foreach(var blockpar in cell)
{
var par = blockpar as Markdig.Syntax.ParagraphBlock;
Debug.WriteLine(par.ToParagraphString());
}
}
}
}
}
if (monster != null)
@ -436,7 +454,8 @@ namespace AideDeJeu.Tools
{
foreach (var block in document)
{
block.Dump();
Debug.WriteLine(block.GetType());
//block.Dump();
}
}

View file

@ -2,6 +2,7 @@
using AideDeJeu.Tools;
using AideDeJeuLib.Monsters;
using AideDeJeuLib.Spells;
using Markdig;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -44,7 +45,10 @@ namespace AideDeJeuCmd
using (var sr = new StreamReader(filename))
{
var md = await sr.ReadToEndAsync();
var document = Markdig.Parsers.MarkdownParser.Parse(md);
var pipeline = new MarkdownPipelineBuilder()
.UsePipeTables()
.Build();
var document = Markdig.Parsers.MarkdownParser.Parse(md, pipeline);
//DumpMarkdownDocument(document);
var monsters = document.ToMonsters();

View file

@ -50,10 +50,11 @@ L'aboleth peut effectuer 3 actions légendaires qu'il choisit parmi celles décr
- ArmorClass: CA 15 (armure naturelle)
- HitPoints: 104 (16d8+32)
- Speed: 9 m au sol
+-------+-------+-------+-------+-------+-------+
| FOR | DEX | CON | INT | SAG | CHA |
| --- | --- | --- | --- | --- | --- |
|16 (+3)|14 (+2)|15 (+2)|18 (+4)|13 (+1)|14 (+2)|
+-------+-------+-------+-------+-------+-------+
- SavingThrows: Int +7, Sag +4, Cha +5
- Competencies: Intimidation +7, Perception +6, Perspicacité +6
- DamageResistancies: acide et froid