public IHtmlable[] ContentAsArray() { IHtmlable[] contentArray = new IHtmlable[Content.Count]; Content.CopyTo( contentArray, 0 ); return(contentArray); }
public IHtmlable[] GetContent() { IHtmlable[] contentArray = new IHtmlable[content.Count]; content.CopyTo(contentArray, 0); return(contentArray); }
public void AddContent( IHtmlable element ) { content.AddLast(element); }
// Given a single line of text, parse this, including special (emph, etc...) sections public static IHtmlable[] ParseInnerText( ParseInput input ) { // Store parsed content as we go LinkedList <IHtmlable> content = new LinkedList <IHtmlable>(); // Until the whole string has been consumed while (input.FirstLine.Length > 0) { ParseResult result; if (MarkdownStrong.CanParseFrom(input)) { result = MarkdownStrong.ParseFrom(input); } else if (MarkdownStrikethrough.CanParseFrom(input)) { result = MarkdownStrikethrough.ParseFrom(input); } else if (MarkdownEmphasis.CanParseFrom(input)) { result = MarkdownEmphasis.ParseFrom(input); } else if (MarkdownCodeInline.CanParseFrom(input)) { result = MarkdownCodeInline.ParseFrom(input); } else if (MarkdownLink.CanParseFrom(input)) { result = MarkdownLink.ParseFrom(input); } else if (MarkdownImage.CanParseFrom(input)) { result = MarkdownImage.ParseFrom(input); } else { result = MarkdownText.ParseFrom( input, false ); } /* * If no parsing method suceeded * for once character to be parsed as text */ if (!result.Success) { result = MarkdownText.ParseFrom( input, true ); } // Extract parsed content foreach (IHtmlable entry in result.GetContent()) { content.AddLast(entry); } // Update text to be parsed input.FirstLine = result.Line; } IHtmlable[] contentArray = new IHtmlable[content.Count]; content.CopyTo( contentArray, 0 ); return(contentArray); }