public static IEnumerable <INode> Partial(string htmlRaw, DocInfo info = null) { htmlRaw = EscapeHtml(htmlRaw); var htmlPortion = new HtmlPortion(htmlRaw); htmlPortion.Jump(); return(new HtmlParser(info).Parse(htmlPortion)); }
public IEnumerable <INode> Parse(HtmlPortion portion, IHtmlParser[] parsers) { Func <HtmlPortion, IHtmlParser[], INode> fn = (p, pa) => { foreach (var parser in parsers) { if (portion.IsEnd) { return(null); } var result = parser.Parse(this, portion); if (result == null) { continue; } return(result); } return(null); }; while (portion.HasNext) { if (portion.IsWhiteSpace) { portion.Next(); continue; } var result = fn(portion, parsers); if (result != null) { yield return(result); if (result is IParseBreak) { yield break; } } else { portion.Jump(); } } }