protected override void RegisterTocToContext(TocItemViewModel toc, FileModel model, IDocumentBuildContext context) { var key = model.Key; // Add current folder to the toc mapping, e.g. `a/` maps to `a/toc` var directory = ((RelativePath)key).GetPathFromWorkingFolder().GetDirectoryPath(); context.RegisterToc(key, directory); var tocInfo = new TocInfo(key); if (toc.Homepage != null) { if (PathUtility.IsRelativePath(toc.Homepage)) { var pathToRoot = ((RelativePath)model.File + (RelativePath)toc.Homepage).GetPathFromWorkingFolder(); tocInfo.Homepage = pathToRoot; } } context.RegisterTocInfo(tocInfo); }
public override void UpdateHref(FileModel model, IDocumentBuildContext context) { var toc = (TocItemViewModel)model.Content; var key = model.Key; // Add current folder to the toc mapping, e.g. `a/` maps to `a/toc` var directory = ((TypeForwardedToRelativePath)key).GetPathFromWorkingFolder().GetDirectoryPath(); context.RegisterToc(key, directory); UpdateTocItemHref(toc, model, context); var tocInfo = new TocInfo(key); if (toc.Homepage != null) { if (TypeForwardedToPathUtility.IsRelativePath(toc.Homepage)) { var pathToRoot = ((TypeForwardedToRelativePath)model.File + (TypeForwardedToRelativePath)toc.Homepage).GetPathFromWorkingFolder(); tocInfo.Homepage = pathToRoot; } } context.RegisterTocInfo(tocInfo); }