Exemple #1
0
        public DocumentationParser(ParserOptions options, IProvideGitFileInformation repoAnalyzer)
            : base(options)
        {
            var documentCompiler = new DocumentCompiler(Parser, options, repoAnalyzer);

            _directoryCompiler = new DocumentationDirectoryCompiler(documentCompiler, options);
        }
Exemple #2
0
        private IEnumerable <ArticlePage> CompileArticleDirectory(string directory)
        {
            var docsFilePath = Path.Combine(directory, Constants.DocumentationFileName);

            if (File.Exists(docsFilePath) == false)
            {
                yield break;
            }

            foreach (var item in DocumentationFileHelper.ParseFile(docsFilePath))
            {
                if (item.IsFolder)
                {
                    foreach (var page in CompileArticleDirectory(Path.Combine(directory, item.Name)))
                    {
                        yield return(page);
                    }

                    continue;
                }

                foreach (var pageToCompile in DocumentationDirectoryCompiler.GetPages(directory, item))
                {
                    yield return(CompileArticlePage(pageToCompile, directory));
                }
            }

            var indexFilePath = Path.Combine(directory, "index" + Constants.MarkdownFileExtension);

            if (File.Exists(indexFilePath) == false)
            {
                yield break;
            }

            var indexItem = new FolderItem(isFolder: false)
            {
                Description = string.Empty,
                Language    = Language.All,
                Name        = "index"
            };

            yield return(CompileArticlePage(indexItem, directory));
        }