Skip to content

Commit

Permalink
fix: skip header/footer rendering for cover page
Browse files Browse the repository at this point in the history
  • Loading branch information
filzrev committed Nov 21, 2024
1 parent 7102b42 commit 3d9aef5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Docfx.App/PdfBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ async Task MergePdf()
if (!pageBytes.TryGetValue(node, out var bytes))
continue;

var isCoverPage = url.AbsolutePath.TrimStart('/').Equals(outline.pdfCoverPage, GetStringComparison());

var isTocPage = IsTocPage(url);
if (isTocPage)
{
Expand All @@ -375,6 +377,9 @@ async Task MergePdf()

var pageBuilder = builder.AddPage(document, i, x => CopyLink(node, x));

if (isCoverPage)
continue;

if (isTocPage)
continue;

Expand Down Expand Up @@ -615,4 +620,12 @@ static string getMillimeter(double pt)
return $"{Math.Round(pt * MillimeterPerInch / Dpi)}mm";
}
}

// Gets StringComparison instance for path string.
private static StringComparison GetStringComparison()
{
return PathUtility.IsPathCaseInsensitive()
? StringComparison.OrdinalIgnoreCase
: StringComparison.Ordinal;
}
}

0 comments on commit 3d9aef5

Please sign in to comment.