public static ListBlock TryParse(CreoleReader reader) { if (reader.NextWord != "*" && reader.NextWord != "#") return null; var markup = reader.ReadLineUntil(l => (l.StartsWith("*") || l.StartsWith("#")) ? -1 : 0, trimLines: true); return new ListBlock(markup); }
public static NoWikiBlock TryParse(CreoleReader reader) { if (reader.Peek(3) != "{{{") return null; var content = reader.ReadLineUntil(l => l.StartsWith("}}}") ? 3 : -1); if (content != null) return new NoWikiBlock(content.Substring(3, content.Length - 6)); return null; }
public static IEnumerable<ParagraphBlock> Parse(string paragraphs) { var reader = new CreoleReader(paragraphs); while (!reader.EndOfMarkup) { var content = reader.ReadLineUntil(l => l.Trim().Length <= 0 ? l.Length : -1); if (content == null) content = reader.ReadToEnd(); else reader.SkipLine(); if (content.Trim().Length <= 0) continue; yield return new ParagraphBlock(content.Trim()); } }