/// <summary> /// Visits the unordered list. /// </summary> /// <param name="list">The list.</param> public virtual void VisitUnorderedList(UnorderedList list) { foreach (var listItem in list.Items) { listItem.Accept(this); } }
public virtual void Visit(UnorderedList list) { _writer.WriteLine("<ul>"); foreach (var listItem in list.Items) { listItem.Accept(this); } _writer.WriteLine("</ul>"); }
/// <summary> /// Visits the unordered list. /// </summary> /// <param name="list">The list.</param> public virtual void VisitUnorderedList(UnorderedList list) { if (list == null) { return; } foreach (var listItem in list.Items) { listItem.Accept(this); } }
protected bool Equals(UnorderedList other) { return(Items.SequenceEqual(other.Items)); }
/// <summary> /// Determines whether the specified <see cref="UnorderedList" />, is equal to this instance. /// </summary> /// <param name="other">The other.</param> /// <returns>true if equal; otherwise, false</returns> protected bool Equals(UnorderedList other) => Items.SequenceEqual(other.Items);
public override void InternalParse(Container container, IDocumentReader reader, Func <string, bool> predicate, ref List <string> buffer, ref AttributeList attributes) { var match = PatternMatcher.CheckListItem.Match(reader.Line); if (!match.Success) { throw new ArgumentException("not a check list item"); } var level = match.Groups["level"].Value; var isChecked = !string.IsNullOrWhiteSpace(match.Groups["checked"].Value); var text = match.Groups["text"].Value; var listItem = new CheckListItem(level.Length, isChecked); listItem.Attributes.Add(attributes); buffer.Add(text); reader.ReadLine(); attributes = null; while (reader.Line != null && !PatternMatcher.ListItemContinuation.IsMatch(reader.Line) && !PatternMatcher.BlankCharacters.IsMatch(reader.Line) && !PatternMatcher.CheckListItem.IsMatch(reader.Line) && !PatternMatcher.ListItem.IsMatch(reader.Line) && (predicate == null || !predicate(reader.Line))) { if (PatternMatcher.ListItemContinuation.IsMatch(reader.Line)) { ProcessBuffer(listItem, ref buffer, ref attributes); reader.ReadLine(); DescendingParse( listItem, reader, line => PatternMatcher.BlankCharacters.IsMatch(line) || PatternMatcher.ListItem.IsMatch(line) || PatternMatcher.CheckListItem.IsMatch(reader.Line), ref buffer, ref attributes); } else { buffer.Add(reader.Line); reader.ReadLine(); } } ProcessBuffer(listItem, ref buffer, ref attributes); UnorderedList unorderedList; if (container.Count > 0) { unorderedList = container[container.Count - 1] as UnorderedList; if (unorderedList != null && unorderedList.Items.Count > 0 && unorderedList.Items[0].Level == listItem.Level) { unorderedList.Items.Add(listItem); } else { unorderedList = new UnorderedList { Items = { listItem } }; container.Add(unorderedList); } } else { unorderedList = new UnorderedList { Items = { listItem } }; container.Add(unorderedList); } attributes = null; }