Skip to content

Commit 2bd3dc1

Browse files
committed
Include pending.dd in the changelog footer generation
1 parent 39fb821 commit 2bd3dc1

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

ddoc/source/preprocessor.d

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,21 +320,34 @@ auto genChangelogVersion(string fileName, string fileText)
320320

321321
// inject the changelog footer
322322
auto fileBaseName = fileName.baseName;
323-
auto r = changelogFiles.enumerate.find!(a => a.value.baseName == fileBaseName);
323+
auto r = changelogFiles.chain("pending.dd".only).enumerate.find!(a => a.value.baseName == fileBaseName);
324324
if (r.length != 0)
325325
{
326326
auto el = r.front;
327327
macros ~= "\nCHANGELOG_NAV_INJECT=";
328328
auto versions = changelogFiles.map!(a => a.baseName.until(".dd"));
329+
auto hasPrerelease = versions[$ - 1].canFind("_pre");
329330
// mapping for the first and last page is different
330331
if (el.index == 0)
332+
{
331333
macros ~="\n$(CHANGELOG_NAV_FIRST %s)".format(versions[1]);
332-
else if (el.index == changelogFiles.length - 1 ||
333-
// prerelease pages shouldn't be linked to from the released versions
334-
el.index == changelogFiles.length - 2 && versions[$ - 1].canFind("_pre"))
335-
macros ~="\n$(CHANGELOG_NAV_LAST %s)".format(versions[el.index - 1]);
334+
}
335+
else if (
336+
// latest version + nightlies (pending.dd)
337+
el.index >= versions.length ||
338+
// prerelease pages
339+
el.index == versions.length - 1 && hasPrerelease)
340+
{
341+
macros ~="\n$(CHANGELOG_NAV_LAST %s)".format(versions.retro.find!(v => !v.canFind("_pre", "pending")).front);
342+
}
343+
else if (el.index == versions.length - 1 && !hasPrerelease)
344+
{
345+
macros ~="\n$(CHANGELOG_NAV_LAST %s)".format(versions[$ - 2]);
346+
}
336347
else
348+
{
337349
macros ~="\n$(CHANGELOG_NAV %s, %s)".format(versions[el.index - 1], versions[el.index + 1]);
350+
}
338351
macros ~= "\n_=";
339352
}
340353
fileText ~= macros;

0 commit comments

Comments
 (0)