private void AssignDiscussionIds(TableOfContents.TableOfContentsItem tocItem, string sourceDirectory, string version) { AssignDiscussionIdsInDocsFile(tocItem, sourceDirectory); var sourceDiscussionId = GetSourceDiscussionId(tocItem, sourceDirectory); AssignDiscussionIdToDerivedPages(tocItem, version, sourceDiscussionId); }
public static string GetDirectoryPath(this TableOfContents.TableOfContentsItem tableOfContentsItem, string version, ParserOptions parserOptions) { var documentationPagesDirectory = parserOptions.GetPathToDocumentationPagesDirectory(version); var filePath = Path.Combine(documentationPagesDirectory, tableOfContentsItem.Key); return(Directory.GetParent(filePath).FullName); }
private IEnumerable <FolderItem> GetPagesForTocItem(TableOfContents.TableOfContentsItem tocItem, string directory) { var matchingFolderItem = GetFolderItemForTocItem(directory, tocItem); var pages = GetPages(directory, matchingFolderItem); foreach (var folderItem in pages) { yield return(folderItem); } }
public TableOfContents.TableOfContentsItem ConvertToTableOfContentsItem(TableOfContentsCompiler.CompilationResult compilationResult) { var tocItem = new TableOfContents.TableOfContentsItem { Key = compilationResult.Key, Title = compilationResult.Title, SourceVersion = compilationResult.SourceVersion, IsFolder = compilationResult.IsFolder, Languages = compilationResult.Languages }; return(tocItem); }
private void AssignDiscussionIdsInDocsFile(TableOfContents.TableOfContentsItem tocItem, string directory, string discussionId = null) { var matchingFolderItem = GetFolderItemForTocItem(directory, tocItem); if (matchingFolderItem == null) { return; } var docsFilePath = Path.Combine(directory, Constants.DocumentationFileName); DocumentationFileHelper.AssignDiscussionIdIfNeeded(docsFilePath, matchingFolderItem, discussionId); }
private FolderItem GetFolderItemForTocItem(string directory, TableOfContents.TableOfContentsItem tocItem) { var docsFilePath = Path.Combine(directory, Constants.DocumentationFileName); if (File.Exists(docsFilePath) == false) { return(null); } var keySuffix = tocItem.GetKeySuffix(); var matchingFolderItem = DocumentationFileHelper.ParseFile(docsFilePath) .SingleOrDefault(x => x.Name == keySuffix); return(matchingFolderItem); }
private static void GenerateForFolder(HtmlHelper htmlHelper, UrlHelper urlHelper, StringBuilder builder, TableOfContents.TableOfContentsItem item, string key, int level, bool containsKey, string version, DocumentationMode mode) { if (mode == DocumentationMode.Legacy) { builder.AppendLine(string.Format("<a href='{0}'>", urlHelper.Action(MVC.Docs.ActionNames.Articles, MVC.Docs.Name, new { version = version, language = Language.Csharp, key = item.Key }))); } builder.AppendLine(string.Format("<span class='fa fa-folder {1}'></span><span>{0}</span>", item.Title, containsKey ? "text-danger" : string.Empty)); if (mode == DocumentationMode.Legacy) { builder.AppendLine("</a>"); } builder.AppendLine("<ul class='list-group'>"); GenerateTableOfContents(htmlHelper, urlHelper, builder, item.Items, key, ++level, version, mode); builder.AppendLine("</ul>"); }
private static void GenerateForArticle(HtmlHelper htmlHelper, StringBuilder builder, TableOfContents.TableOfContentsItem item) { var link = htmlHelper.ActionLink(item.Title, MVC.Docs.ActionNames.Articles, MVC.Docs.Name, new { key = item.Key }, null).ToHtmlString(); builder.AppendLine(string.Format("<span class='fa fa-file-text-o'></span>{0}", link)); }
public static string GetSourceBaseDirectory(this TableOfContents.TableOfContentsItem tableOfContentsItem, ParserOptions parserOptions) { var version = tableOfContentsItem.SourceVersion; return(GetDirectoryPath(tableOfContentsItem, version, parserOptions)); }
private void AssignDiscussionIdToDerivedPages(TableOfContents.TableOfContentsItem tocItem, string version, string sourceDiscussionId) { var directory = tocItem.GetDirectoryPath(version, Options); AssignDiscussionIdsInDocsFile(tocItem, directory, sourceDiscussionId); }
private string GetSourceDiscussionId(TableOfContents.TableOfContentsItem tocItem, string directory) { var matchingFolderItem = GetFolderItemForTocItem(directory, tocItem); return(matchingFolderItem.DiscussionId); }