From d0ece925502067eb5303854cc21101f53d92d3e8 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 14 Jun 2022 00:08:05 +0200 Subject: [PATCH] return the ElementType along with each Element in Parse --- MLEM.Ui/Parsers/UiMarkdownParser.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MLEM.Ui/Parsers/UiMarkdownParser.cs b/MLEM.Ui/Parsers/UiMarkdownParser.cs index 28ee399..17b7951 100644 --- a/MLEM.Ui/Parsers/UiMarkdownParser.cs +++ b/MLEM.Ui/Parsers/UiMarkdownParser.cs @@ -78,22 +78,22 @@ namespace MLEM.Ui.Parsers { /// The element to add the parsed elements to. /// The , for chaining. public Element ParseInto(string markdown, Element element) { - foreach (var el in this.Parse(markdown)) - element.AddChild(el); + foreach (var (_, e) in this.Parse(markdown)) + element.AddChild(e); return element; } /// - /// Parses the given markdown string into a set of elements and returns them. + /// Parses the given markdown string into a set of elements and returns them along with their . /// During this process, the element stylings specified using are also applied. /// /// The markdown to parse. /// The parsed elements. - public IEnumerable Parse(string markdown) { - foreach (var (type, element) in this.ParseUnstyled(markdown)) { - if (this.elementStyles.TryGetValue(type, out var style)) - style.Invoke(element); - yield return element; + public IEnumerable<(ElementType, Element)> Parse(string markdown) { + foreach (var (t, e) in this.ParseUnstyled(markdown)) { + if (this.elementStyles.TryGetValue(t, out var style)) + style.Invoke(e); + yield return (t, e); } }