1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-22 01:53:24 +00:00

Trop de liens pour l'instant ;)

This commit is contained in:
Yan Maniez 2018-08-04 23:50:50 +02:00
parent c65849a772
commit 7fb7c6d4bc
3 changed files with 100 additions and 31 deletions

View file

@ -54,8 +54,25 @@ namespace AideDeJeu.Tools
var linkInline = paragraphBlock?.Inline?.FirstChild as LinkInline;
if (linkInline != null)
{
var label = linkInline.Label;
var title = linkInline.Title;
if (title == string.Empty)
if (title == string.Empty && label != string.Empty)
{
return true;
}
}
return false;
}
public static bool IsClosingItem(this Block block)
{
var paragraphBlock = block as ParagraphBlock;
var linkInline = paragraphBlock?.Inline?.FirstChild as LinkInline;
if (linkInline != null)
{
var label = linkInline.Label;
var title = linkInline.Title;
if (title == string.Empty && label == string.Empty)
{
return true;
}

View file

@ -41,10 +41,8 @@ namespace AideDeJeuLib
return _Items?.GetEnumerator();
}
public override void Parse(ref ContainerBlock.Enumerator enumerator)
public void ParseHeader(ref ContainerBlock.Enumerator enumerator)
{
var items = new List<Item>();
enumerator.MoveNext();
while (enumerator.Current != null)
{
var block = enumerator.Current;
@ -52,12 +50,12 @@ namespace AideDeJeuLib
{
break;
}
else if(block is HeadingBlock)
else if (block is HeadingBlock)
{
var headingBlock = block as HeadingBlock;
if(headingBlock.Level == 1 && headingBlock.HeaderChar == '#')
if (headingBlock.Level == 1 && headingBlock.HeaderChar == '#')
{
this.Name = headingBlock.Inline.ToMarkdownString();
Name = headingBlock.Inline.ToMarkdownString();
}
else
@ -71,9 +69,21 @@ namespace AideDeJeuLib
}
enumerator.MoveNext();
}
}
public override void Parse(ref ContainerBlock.Enumerator enumerator)
{
var items = new List<Item>();
enumerator.MoveNext();
ParseHeader(ref enumerator);
while (enumerator.Current != null)
{
var item = enumerator.Current.GetNewItem();
var block = enumerator.Current;
if (block.IsClosingItem())
{
break;
}
var item = block.GetNewItem();
item.Parse(ref enumerator);
items.Add(item);
}