public IReaderMode Read(int indention, string text) { // New step, go on if (text.StartsWith("|>") || text.StartsWith(">")) { return(null); } if (text.IsSectionHeader()) { var section = text.ToSection(); Step.Collections[section.Key] = section; return(new SectionMode(section) { Indention = indention }); } if (text.IsTableLine()) { var section = new Section(Table.DefaultCollectionName); Step.Collections[Table.DefaultCollectionName] = section; var table = new TableParser(section) { Indention = indention }; table.Read(indention, text); return(table); } if (text.StartsWith(BigTextParser.Delimiter)) { return(new BigTextParser(Step, text) { Indention = indention }); } if (text.IsEmpty()) { return(this); } return(null); }
public IReaderMode Read(int indention, string text) { if (text.StartsWith("|>")) { if (indention == Indention) { var mode = new StepMode(text); Section.Children.Add(mode.Step); return(mode); } return(null); } // Just keep going if (text.IsEmpty()) { return(this); } // Need to pop this mode in the reader if (text.IsSectionHeader()) { return(null); } if (text.IsMetadata()) { string cell; string value; text.ParseMetadata(out cell, out value); Section.ActiveCells.Add(cell, bool.Parse(value)); return(this); } if (indention != Indention) { return(null); } if (text == MarkdownWriter.SectionEnd) { return(null); } if (text.IsTableLine()) { var table = new TableParser(Section) { Indention = indention }; table.Read(indention, text); return(table); } // Assume it's a comment var comment = new CommentMode(Section); comment.Read(indention, text); return(comment); }