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

Properties gérées au niveau viewer markdown

This commit is contained in:
Yan Maniez 2018-07-21 09:49:16 +02:00
parent 3ad3045b25
commit b6a48565c2
2 changed files with 60 additions and 89 deletions

View file

@ -218,6 +218,8 @@
Margin = new Thickness(listScope * this.Theme.Margin, 0, 0, 0),
};
if (parent.BulletType != '-')
{
View bullet;
if (parent.IsOrdered)
@ -253,7 +255,7 @@
}
horizontalStack.Children.Add(bullet);
}
horizontalStack.Children.Add(this.stack);
initialStack.Children.Add(horizontalStack);

View file

@ -19,8 +19,8 @@ namespace AideDeJeuLib
get
{
return
$"# {Name}\n\n" +
$"{AltName}\n\n" +
//$"# {Name}\n\n" +
//$"{AltName}\n\n" +
Text;
}
}
@ -31,56 +31,36 @@ namespace AideDeJeuLib
while (enumerator.Current != null)
{
var block = enumerator.Current;
if (block is HeadingBlock)
{
var headingBlock = block as HeadingBlock;
if (headingBlock.HeaderChar == '#' && (headingBlock.Level == 1 || headingBlock.Level == 2))
{
if (this.Name == null)
{
this.Name = headingBlock.Inline.ToMarkdownString();
}
else
{
this.Text += block.ToMarkdownString();
}
}
else
{
this.Text += block.ToMarkdownString();
}
}
else if (block is ParagraphBlock)
{
if (block.IsNewItem())
{
return;
}
//var paragraphBlock = block as ParagraphBlock;
//this.Text += paragraphBlock.ToMarkdownString() + "\n";
if (block is HeadingBlock)
{
var headingBlock = block as HeadingBlock;
if (this.Name == null)
{
this.Name = headingBlock.Inline.ToMarkdownString();
}
this.Text += block.ToMarkdownString();
}
else if (block is ListBlock)
{
var listBlock = block as ListBlock;
if (listBlock.BulletType == '-')
{
foreach (var inblock in listBlock)
{
var regex = new Regex("(?<key>.*?): (?<value>.*)");
if (inblock is ListItemBlock)
{
var listItemBlock = inblock as ListItemBlock;
foreach (var ininblock in listItemBlock)
{
if (ininblock is ParagraphBlock)
{
var paragraphBlock = ininblock as ParagraphBlock;
var str = paragraphBlock.Inline.ToMarkdownString();
var str = block.ToMarkdownString();
var properties = new List<Tuple<string, Action<Generic, string>>>()
{
new Tuple<string, Action<Generic, string>>("AltName: ", (m, s) => m.AltName = s),
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)
@ -91,23 +71,12 @@ namespace AideDeJeuLib
break;
}
}
}
}
}
}
}
else
{
this.Text += block.ToMarkdownString();
}
}
else if (block is Markdig.Extensions.Tables.Table)
{
this.Text += block.ToMarkdownString();
//var tableBlock = block as Markdig.Extensions.Tables.Table;
//this.Text += "\n\n" + tableBlock.ToMarkdownString() + "\n\n";
}
else
{
this.Text += block.ToMarkdownString();