1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-31 15:36:07 +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), Margin = new Thickness(listScope * this.Theme.Margin, 0, 0, 0),
}; };
if (parent.BulletType != '-')
{
View bullet; View bullet;
if (parent.IsOrdered) if (parent.IsOrdered)
@ -253,7 +255,7 @@
} }
horizontalStack.Children.Add(bullet); horizontalStack.Children.Add(bullet);
}
horizontalStack.Children.Add(this.stack); horizontalStack.Children.Add(this.stack);
initialStack.Children.Add(horizontalStack); initialStack.Children.Add(horizontalStack);

View file

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