private void GetTocInfo(DocumentBuildContext context, ManifestItem item) { string relativePath = item.OriginalFile; var tocMap = context.TocMap; var fileMap = context.FileMap; HashSet<string> parentTocs; string parentToc = null; string rootToc = null; string currentPath = ((RelativePath)relativePath).GetPathFromWorkingFolder(); while (tocMap.TryGetValue(currentPath, out parentTocs) && parentTocs.Count > 0) { // Get the first toc only currentPath = parentTocs.First(); rootToc = currentPath; if (parentToc == null) parentToc = currentPath; currentPath = ((RelativePath)currentPath).GetPathFromWorkingFolder(); } if (rootToc != null) { rootToc = fileMap[((RelativePath)rootToc).GetPathFromWorkingFolder()]; PathUtility.TryGetPathFromWorkingFolder(rootToc, out rootToc); RootTocPath = rootToc; } if (parentToc == null) TocPath = RootTocPath; else { parentToc = fileMap[((RelativePath)parentToc).GetPathFromWorkingFolder()]; PathUtility.TryGetPathFromWorkingFolder(parentToc, out parentToc); TocPath = parentToc; } }
public SystemAttributes(DocumentBuildContext context, ManifestItem item, string lang) { Language = lang; GetTocInfo(context, item); TocRelativePath = TocPath == null ? null : ((RelativePath)TocPath).MakeRelativeTo((RelativePath)item.ModelFile); RootTocRelativePath = RootTocPath == null ? null : ((RelativePath)RootTocPath).MakeRelativeTo((RelativePath)item.ModelFile); RelativePathToRoot = (RelativePath.Empty).MakeRelativeTo((RelativePath)item.ModelFile); }
public ManifestItemWithContext(ManifestItem item, FileModel model, IDocumentProcessor processor) { Item = item; FileModel = model; Processor = processor; }