private XRefSpec GetXrefFromUid(string uid, FileModel model, IDocumentBuildContext context) { var xref = context.GetXrefSpec(uid); if (xref == null) { Logger.LogWarning($"Unable to find file with uid \"{uid}\" referenced by TOC file \"{model.LocalPathFromRoot}\""); } return(xref); }
private XRefSpec GetXrefFromUid(string uid, FileModel model, IDocumentBuildContext context, string includedFrom) { var xref = context.GetXrefSpec(uid); if (xref == null) { Logger.LogWarning( $"Unable to find file with uid \"{uid}\" referenced by TOC file \"{includedFrom ?? model.LocalPathFromRoot}\"", code: WarningCodes.Build.UidNotFound, file: includedFrom); } return(xref); }
private static void UpdateXref(HtmlNode node, IDocumentBuildContext context, string language) { var xref = XRefDetails.From(node); // Resolve external xref map first, and then internal xref map. // Internal one overrides external one var xrefSpec = context.GetXrefSpec(HttpUtility.HtmlDecode(xref.Uid)); xref.ApplyXrefSpec(xrefSpec); var convertedNode = xref.ConvertToHtmlNode(language); node.ParentNode.ReplaceChild(convertedNode, node); if (xrefSpec == null && xref.ThrowIfNotResolved) { throw new CrossReferenceNotResolvedException(xref); } }
private (bool resolved, bool warn) UpdateXref(HtmlNode node, IDocumentBuildContext context, string language, out XRefDetails xref) { xref = XRefDetails.From(node); XRefSpec xrefSpec = null; if (!string.IsNullOrEmpty(xref.Uid)) { // Resolve external xref map first, and then internal xref map. // Internal one overrides external one xrefSpec = context.GetXrefSpec(HttpUtility.HtmlDecode(xref.Uid)); xref.ApplyXrefSpec(xrefSpec); } var renderer = xref.TemplatePath == null ? null : _rendererLoader.Load(xref.TemplatePath); var(convertedNode, resolved) = xref.ConvertToHtmlNode(language, renderer); node.ParentNode.ReplaceChild(convertedNode, node); var warn = xrefSpec == null && xref.ThrowIfNotResolved; return(resolved, warn); }
private static bool UpdateXref(HtmlNode node, IDocumentBuildContext context, string language, out XRefDetails xref) { xref = XRefDetails.From(node); XRefSpec xrefSpec = null; if (!string.IsNullOrEmpty(xref.Uid)) { // Resolve external xref map first, and then internal xref map. // Internal one overrides external one xrefSpec = context.GetXrefSpec(HttpUtility.HtmlDecode(xref.Uid)); xref.ApplyXrefSpec(xrefSpec); } var convertedNode = xref.ConvertToHtmlNode(language); node.ParentNode.ReplaceChild(convertedNode, node); if (xrefSpec == null && xref.ThrowIfNotResolved == true) { return(false); } return(true); }
private XRefSpec GetXrefFromUid(string uid, FileModel model, IDocumentBuildContext context) { var xref = context.GetXrefSpec(uid); if (xref == null) { throw new DocumentException($"Unable to find file with uid \"{uid}\" referenced by TOC file \"{model.LocalPathFromRepoRoot}\""); } return xref; }
private static void UpdateXref(HtmlAgilityPack.HtmlNode node, IDocumentBuildContext context, string language) { var xref = XRefDetails.From(node); // Resolve external xref map first, and then internal xref map. // Internal one overrides external one var xrefSpec = context.GetXrefSpec(xref.Uid); xref.ApplyXrefSpec(xrefSpec); var convertedNode = xref.ConvertToHtmlNode(language); node.ParentNode.ReplaceChild(convertedNode, node); if (xrefSpec == null) { if (xref.ThrowIfNotResolved) { throw new CrossReferenceNotResolvedException(xref.Uid, xref.RawSource, null); } } }