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

Gestion partielle des tables markdown génériques

This commit is contained in:
Nioux 2018-06-26 13:36:48 +02:00
parent bca32aa4a9
commit c6d9f99c77

View file

@ -185,6 +185,12 @@ namespace AideDeJeu.Tools
}
}
}
else if (block is Markdig.Extensions.Tables.Table)
{
var tableBlock = block as Markdig.Extensions.Tables.Table;
spell.DescriptionHtml += tableBlock.ToMarkdownString();
}
}
if (spell != null)
@ -430,6 +436,10 @@ namespace AideDeJeu.Tools
monster.Wisdom = table["WIS"].FirstOrDefault();
monster.Charisma = table["CHA"].FirstOrDefault();
}
//else
//{
features?.Add(tableBlock.ToMarkdownString());
//}
}
else if (block is Markdig.Syntax.LinkReferenceDefinitionGroup)
{
@ -533,6 +543,24 @@ namespace AideDeJeu.Tools
}
return str;
}
public static string ToMarkdownString(this Markdig.Extensions.Tables.Table tableBlock)
{
var ret = string.Empty;
foreach(Markdig.Extensions.Tables.TableRow row in tableBlock)
{
var line = "|";
foreach(Markdig.Extensions.Tables.TableCell cell in row)
{
foreach(Markdig.Syntax.ParagraphBlock block in cell)
{
line += block.ToMarkdownString();
}
line += "|";
}
ret += line + "\r\n";
}
return ret;
}
public static Dictionary<string, List<string>> ToTable(this Markdig.Extensions.Tables.Table tableBlock)
{