예제 #1
0
        public void CreateArticles(IEnumerable <SDArticle> articles, int navigationLevel)
        {
            foreach (var article in articles)
            {
                var placeholder = article as SDDocPlaceholder;
                if (placeholder != null)
                {
                    _wordTemplater.AppendHeader(article.Title, navigationLevel);
                    _apiBuilder.CreateApiDoc(_sdProject.Repositories[placeholder.SolutionFile], navigationLevel + 1);
                }
                else if (article is SDArticlePlaceholder)
                {
                    _wordTemplater.AppendHeader(article.Title, navigationLevel);
                }
                else
                {
                    _wordTemplater.AppendHeader(article.Title, navigationLevel);
                    _wordTemplater.AppendMarkdown(article.Content.Transform(new Helper(_sdProject).TransformLinkToken));
                    _wordTemplater.AppendPageBreak();
                }

                if (article.Children.Count > 0)
                {
                    CreateArticles(article.Children, navigationLevel + 1);
                }
            }
        }
예제 #2
0
        public void BuildDocument()
        {
            InitDocument();

            if (_sdProject.Articles.Count != 0)
            {
                List <SDArticle> articles;
                _sdProject.Articles.TryGetValue(_docLanguage, out articles);
                articles = articles ?? _sdProject.Articles["default"];
                _articleBuilder.CreateArticles(articles, 1);
            }
            else
            {
                _apiBuilder.CreateApiDoc(_sdProject.Repositories.Single().Value, 1);
            }

            _wordTemplater.Close();
        }