public string ResolveSourceRelativePath(string originPath, string currentFileOutputPath) { if (string.IsNullOrEmpty(originPath) || !PathUtility.IsRelativePath(originPath)) { return(originPath); } var origin = (RelativePath)originPath; if (origin == null) { return(originPath); } var destPath = _context.GetFilePath(origin.GetPathFromWorkingFolder().ToString()); if (destPath != null) { return(((RelativePath)destPath - ((RelativePath)currentFileOutputPath).GetPathFromWorkingFolder()).ToString()); } else { Logger.LogWarning($"Can't find output file for {originPath}"); return(originPath); } }
private static List <HomepageInfo> GetHomepages(DocumentBuildContext context) { return((from s in context.GetTocInfo() where !string.IsNullOrEmpty(s.Homepage) select new HomepageInfo { Homepage = RelativePath.GetPathWithoutWorkingFolderChar(s.Homepage), TocPath = RelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey)) }).ToList()); }
/// <summary> /// Export xref map file. /// </summary> private static string ExportXRefMap(DocumentBuildParameters parameters, DocumentBuildContext context) { Logger.LogVerbose("Exporting xref map..."); var xrefMap = new XRefMap(); xrefMap.References = (from xref in context.XRefSpecMap.Values.AsParallel().WithDegreeOfParallelism(parameters.MaxParallelism) select new XRefSpec(xref) { Href = ((RelativePath)context.GetFilePath(UriUtility.GetNonFragment(xref.Href))).RemoveWorkingFolder() + UriUtility.GetFragment(xref.Href) }).ToList(); xrefMap.Sort(); string xrefMapFileNameWithVersion = string.IsNullOrEmpty(parameters.VersionName) ? XRefMapFileName : parameters.VersionName + "." + XRefMapFileName; YamlUtility.Serialize( xrefMapFileNameWithVersion, xrefMap, YamlMime.XRefMap); Logger.LogInfo("XRef map exported."); return(xrefMapFileNameWithVersion); }
private static List<HomepageInfo> GetHomepages(DocumentBuildContext context) { return context.GetTocInfo() .Where(s => !string.IsNullOrEmpty(s.Homepage)) .Select(s => new HomepageInfo { Homepage = RelativePath.GetPathWithoutWorkingFolderChar(s.Homepage), TocPath = RelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey)) }).ToList(); }
private static List <HomepageInfo> GetHomepages(DocumentBuildContext context) { return(context.GetTocInfo() .Where(s => !string.IsNullOrEmpty(s.Homepage)) .Select(s => new HomepageInfo { Homepage = TypeForwardedToRelativePath.GetPathWithoutWorkingFolderChar(s.Homepage), TocPath = TypeForwardedToRelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey)) }).ToList()); }