示例#1
0
 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;
 }
示例#2
0
        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);
        }
示例#3
0
 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;
 }
示例#4
0
        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);
        }