public static EmphasisInline TryParse(CreoleReader reader) { if (reader.Peek(2) != "//" || HasLinkPrefix(reader)) return null; int index = 0; while (true) { index = reader.IndexOf("//", index + 2); if (index == -1) break; if (!HasLinkPrefix(reader, index)) break; } reader.Skip(2); string content; if (index != -1) { content = reader.Read(index - 2); reader.Skip(2); } else { content = reader.ReadToEnd(); } return new EmphasisInline(content); }
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()); } }
public static StrongInline TryParse(CreoleReader reader) { if (reader.Peek(2) != "**") return null; var index = reader.IndexOf("**", 2); reader.Skip(2); string content; if (index != -1) { content = reader.Read(index - 2); reader.Skip(2); } else { content = reader.ReadToEnd(); } return new StrongInline(content); }