public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent; while (content.Length > 0) { state = state.ApplyRules(rules, ref content); } return state.Root; }
public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent; while (content.Length > 0) { state = state.ApplyRules(rules, ref content); } return(state.Root); }
public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new TopicXrefAutoLinkTocParseRule(), new TopicXrefShortcutTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent.Replace("\r\n", "\n").Replace("\r", "\n"); int lineNumber = 1; while (content.Length > 0) { state = state.ApplyRules(rules, ref content, ref lineNumber); } return state.Root; }
public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new TopicXrefAutoLinkTocParseRule(), new TopicXrefShortcutTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent.Replace("\r\n", "\n").Replace("\r", "\n"); int lineNumber = 1; while (content.Length > 0) { state = state.ApplyRules(rules, ref content, ref lineNumber); } return(state.Root); }