1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-24 11:03:25 +00:00
This commit is contained in:
Yan Maniez 2018-08-15 10:29:11 +02:00
parent 5c1bdda78b
commit 9dda5f0eb2
2 changed files with 39 additions and 18 deletions

View file

@ -42,28 +42,43 @@ namespace AideDeJeuLib
var listBlock = block as ListBlock; var listBlock = block as ListBlock;
if (listBlock.BulletType == '-') if (listBlock.BulletType == '-')
{ {
var regex = new Regex("(?<key>.*?): (?<value>.*)"); foreach (var inblock in listBlock)
var str = block.ToMarkdownString();
var properties = new List<Tuple<string, Action<Generic, string>>>()
{
new Tuple<string, Action<Generic, string>>("- AltName: ", (m, s) =>
{
this.Text += "- " + s; m.AltName = s;
}),
new Tuple<string, Action<Generic, string>>("", (m, s) =>
{
this.Text += str;
}),
};
foreach (var property in properties)
{ {
if (str.StartsWith(property.Item1)) if (inblock is Markdig.Syntax.ListItemBlock)
{ {
property.Item2.Invoke(this, str.Substring(property.Item1.Length)); var listItemBlock = inblock as Markdig.Syntax.ListItemBlock;
break; foreach (var ininblock in listItemBlock)
{
if (ininblock is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
var str = paragraphBlock.ToMarkdownString();
var regex = new Regex("(?<key>.*?): (?<value>.*)");
var properties = new List<Tuple<string, Action<Generic, string>>>()
{
new Tuple<string, Action<Generic, string>>("AltName: ", (m, s) =>
{
this.Text += "- " + s; m.AltName = s;
}),
new Tuple<string, Action<Generic, string>>("", (m, s) =>
{
this.Text += str;
}),
};
foreach (var property in properties)
{
if (str.StartsWith(property.Item1))
{
property.Item2.Invoke(this, str.Substring(property.Item1.Length));
break;
}
}
}
}
} }
} }
this.Text += "\n";
} }
else else
{ {

View file

@ -21,6 +21,12 @@ namespace AideDeJeuLib
} }
else else
{ {
regex = new Regex("(?<text>.*?)( \\(SRD p\\d*\\))");
match = regex.Match(AltName ?? string.Empty);
if (!string.IsNullOrEmpty(match.Groups["text"].Value))
{
return match.Groups["text"].Value;
}
return AltName ?? string.Empty; return AltName ?? string.Empty;
} }
} }