/// <summary> /// Writes the table of all source-only packages within the code model into the output /// </summary> /// <param name="root">Code model root</param> /// <param name="markup">Markup provider</param> /// <returns>True when any output has been generated</returns> public async Task <bool> WriteIndexAsync(RootMember root, IMarkupProvider markup) { if (SourceOnlyPackages == null || SourceOnlyPackages.Count < 1) { return(false); } await markup.WriteH2Async("Source-only packages", "package-list"); await markup.WriteTableHeaderAsync("Name", "Summary"); foreach (var nuProps in SourceOnlyPackages.OrderBy(p => p.PackageId)) { await markup.WriteTableColsAsync(Link(nuProps.PackageId, nuProps, markup), nuProps.PackageDescription ?? string.Empty); } await markup.WriteTableFooterAsync(); return(true); }
/// <summary> /// Writes the source-only packages pages into the output /// </summary> /// <param name="root">Code model root</param> /// <param name="markup">Markup provider</param> /// <param name="generator">Markup generator</param> /// <returns>Async task</returns> public async Task WriteOwnPagesAsync(RootMember root, IMarkupProvider markup, MarkupGenerator generator) { if (SourceOnlyPackages == null || SourceOnlyPackages.Count < 1) { return; } if (OutputOptions.SplitNs && !OutputOptions.SplitType) { //split by Ns only -> all source only packages will be on single page await generator.SplitAsync(GetPackagePagesFileName()); } foreach (var nuProps in SourceOnlyPackages.OrderBy(p => p.PackageId)) { if (OutputOptions.SplitType) { //split by Type -> each source only packages will be on dedicated page await generator.SplitAsync(GetPackagePageFileName(nuProps)); } await markup.WriteH2Async($"{nuProps.PackageId} Source only package", GetPackageAnchor(nuProps)); await markup.WriteParaAsync( markup.Small( new Txt() .AddIf($"Version: {nuProps.PackageVersion}", !string.IsNullOrEmpty(nuProps.PackageVersion)) .AddIf(markup.LineBreak(), !string.IsNullOrEmpty(nuProps.PackageVersion)) .AddIf($"Tags: {nuProps.PackageTags}", !string.IsNullOrEmpty(nuProps.PackageTags)) .AddIf(markup.LineBreak(), !string.IsNullOrEmpty(nuProps.PackageTags)) .Add($"Includes: {nuProps.IncludesType}") .Add(markup.LineBreak()) .Add($"Declaring file: { PathUtils.GetRelativeSourceFile(nuProps.DeclaringFile,root.ProjectRootDir)}") )); await markup.WriteParaAsync(nuProps.PackageDescription); if (nuProps.Usings != null && nuProps.Usings.Count > 0) { await markup.WriteParaAsync(new Txt() .Add(markup.Bold("Usings")) .Add(markup.DescriptionList( u => { var refPkg = SourceOnlyPackages.FirstOrDefault(p => p.PackageId == u.PackageId); return(refPkg == null ? u.PackageId : Link(u.PackageId, refPkg, markup)); }, u => string.IsNullOrEmpty(u.PackageVersion) ? string.Empty : $"version: {u.PackageVersion}", nuProps.Usings))); } if (nuProps.ExternalReferences != null && nuProps.ExternalReferences.Count > 0) { await markup.WriteParaAsync(new Txt() .Add(markup.Bold("References needed")) .Add(markup.DescriptionList( er => er, er => string.Empty, nuProps.ExternalReferences))); } if (nuProps.PackageRemarksSource != null && root.AllMembersByDocId.TryGetValue(nuProps.PackageRemarksSource, out var member)) { var remarksDocumentation = member.Documentation?.GetRemarks(member)?.Render(markup, member); if (!string.IsNullOrEmpty(remarksDocumentation)) { await markup.WriteH3Async("Remarks"); await markup.WriteParaAsync(remarksDocumentation); } } if (MembersBySourceOnlyPackage.TryGetValue(nuProps, out var members) && members.Count > 0) { await markup.WriteParaAsync(new Txt() .Add(markup.Bold("Package members")) .Add(markup.DescriptionList( m => markup.Link($"{m.Name} ({m.MemberKind})", m), m => m.Documentation?.GetSummary(m)?.Render(markup, m), members))); } await markup.WriteParaAsync(new Txt() .Add(markup.Bold("Sources")) .Add(markup.DescriptionList( f => $"{PathUtils.GetRelativeSourceFile(f,root.ProjectRootDir)}", f => string.Empty, nuProps.PackageFiles))); await generator.WritePageFooterAsync(); } }