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:
parent
3ad3045b25
commit
b6a48565c2
2 changed files with 60 additions and 89 deletions
|
|
@ -218,42 +218,44 @@
|
||||||
Margin = new Thickness(listScope * this.Theme.Margin, 0, 0, 0),
|
Margin = new Thickness(listScope * this.Theme.Margin, 0, 0, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
View bullet;
|
if (parent.BulletType != '-')
|
||||||
|
|
||||||
if (parent.IsOrdered)
|
|
||||||
{
|
{
|
||||||
bullet = new Label
|
View bullet;
|
||||||
{
|
|
||||||
Text = $"{index}.",
|
|
||||||
FontSize = this.Theme.Paragraph.FontSize,
|
|
||||||
TextColor = this.Theme.Paragraph.ForegroundColor,
|
|
||||||
VerticalOptions = LayoutOptions.Start,
|
|
||||||
HorizontalOptions = LayoutOptions.End,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bullet = new Label
|
|
||||||
{
|
|
||||||
Text = "●",
|
|
||||||
FontSize = this.Theme.Paragraph.FontSize,
|
|
||||||
TextColor = this.Theme.Paragraph.ForegroundColor,
|
|
||||||
VerticalOptions = LayoutOptions.Start,
|
|
||||||
HorizontalOptions = LayoutOptions.End,
|
|
||||||
};
|
|
||||||
//bullet = new BoxView
|
|
||||||
//{
|
|
||||||
// WidthRequest = 4,
|
|
||||||
// HeightRequest = 4,
|
|
||||||
// Margin = new Thickness(0, 6, 0, 0),
|
|
||||||
// BackgroundColor = this.Theme.Paragraph.ForegroundColor,
|
|
||||||
// VerticalOptions = LayoutOptions.Start,
|
|
||||||
// HorizontalOptions = LayoutOptions.Center,
|
|
||||||
//};
|
|
||||||
}
|
|
||||||
|
|
||||||
horizontalStack.Children.Add(bullet);
|
if (parent.IsOrdered)
|
||||||
|
{
|
||||||
|
bullet = new Label
|
||||||
|
{
|
||||||
|
Text = $"{index}.",
|
||||||
|
FontSize = this.Theme.Paragraph.FontSize,
|
||||||
|
TextColor = this.Theme.Paragraph.ForegroundColor,
|
||||||
|
VerticalOptions = LayoutOptions.Start,
|
||||||
|
HorizontalOptions = LayoutOptions.End,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bullet = new Label
|
||||||
|
{
|
||||||
|
Text = "●",
|
||||||
|
FontSize = this.Theme.Paragraph.FontSize,
|
||||||
|
TextColor = this.Theme.Paragraph.ForegroundColor,
|
||||||
|
VerticalOptions = LayoutOptions.Start,
|
||||||
|
HorizontalOptions = LayoutOptions.End,
|
||||||
|
};
|
||||||
|
//bullet = new BoxView
|
||||||
|
//{
|
||||||
|
// WidthRequest = 4,
|
||||||
|
// HeightRequest = 4,
|
||||||
|
// Margin = new Thickness(0, 6, 0, 0),
|
||||||
|
// BackgroundColor = this.Theme.Paragraph.ForegroundColor,
|
||||||
|
// VerticalOptions = LayoutOptions.Start,
|
||||||
|
// HorizontalOptions = LayoutOptions.Center,
|
||||||
|
//};
|
||||||
|
}
|
||||||
|
|
||||||
|
horizontalStack.Children.Add(bullet);
|
||||||
|
}
|
||||||
|
|
||||||
horizontalStack.Children.Add(this.stack);
|
horizontalStack.Children.Add(this.stack);
|
||||||
initialStack.Children.Add(horizontalStack);
|
initialStack.Children.Add(horizontalStack);
|
||||||
|
|
|
||||||
|
|
@ -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,33 +31,17 @@ namespace AideDeJeuLib
|
||||||
while (enumerator.Current != null)
|
while (enumerator.Current != null)
|
||||||
{
|
{
|
||||||
var block = enumerator.Current;
|
var block = enumerator.Current;
|
||||||
|
if (block.IsNewItem())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (block is HeadingBlock)
|
if (block is HeadingBlock)
|
||||||
{
|
{
|
||||||
var headingBlock = block as HeadingBlock;
|
var headingBlock = block as HeadingBlock;
|
||||||
if (headingBlock.HeaderChar == '#' && (headingBlock.Level == 1 || headingBlock.Level == 2))
|
if (this.Name == null)
|
||||||
{
|
{
|
||||||
if (this.Name == null)
|
this.Name = headingBlock.Inline.ToMarkdownString();
|
||||||
{
|
|
||||||
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";
|
|
||||||
this.Text += block.ToMarkdownString();
|
this.Text += block.ToMarkdownString();
|
||||||
}
|
}
|
||||||
else if (block is ListBlock)
|
else if (block is ListBlock)
|
||||||
|
|
@ -65,35 +49,26 @@ namespace AideDeJeuLib
|
||||||
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 str = block.ToMarkdownString();
|
||||||
|
var properties = new List<Tuple<string, Action<Generic, string>>>()
|
||||||
{
|
{
|
||||||
var regex = new Regex("(?<key>.*?): (?<value>.*)");
|
new Tuple<string, Action<Generic, string>>("- AltName: ", (m, s) =>
|
||||||
if (inblock is ListItemBlock)
|
|
||||||
{
|
{
|
||||||
var listItemBlock = inblock as ListItemBlock;
|
this.Text += "- " + s; m.AltName = s;
|
||||||
foreach (var ininblock in listItemBlock)
|
}),
|
||||||
{
|
new Tuple<string, Action<Generic, string>>("", (m, s) =>
|
||||||
if (ininblock is ParagraphBlock)
|
{
|
||||||
{
|
this.Text += str;
|
||||||
var paragraphBlock = ininblock as ParagraphBlock;
|
}),
|
||||||
var str = paragraphBlock.Inline.ToMarkdownString();
|
};
|
||||||
|
|
||||||
var properties = new List<Tuple<string, Action<Generic, string>>>()
|
foreach (var property in properties)
|
||||||
{
|
{
|
||||||
new Tuple<string, Action<Generic, string>>("AltName: ", (m, s) => m.AltName = s),
|
if (str.StartsWith(property.Item1))
|
||||||
};
|
{
|
||||||
|
property.Item2.Invoke(this, str.Substring(property.Item1.Length));
|
||||||
foreach (var property in properties)
|
break;
|
||||||
{
|
|
||||||
if (str.StartsWith(property.Item1))
|
|
||||||
{
|
|
||||||
property.Item2.Invoke(this, str.Substring(property.Item1.Length));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,12 +77,6 @@ namespace AideDeJeuLib
|
||||||
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();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue