Skip to content

Commit 9ffc85e

Browse files
committed
whatsnew: auto-detect links to forum post and threads
1 parent 63759e3 commit 9ffc85e

File tree

2 files changed

+85
-71
lines changed

2 files changed

+85
-71
lines changed

BuildUtils/MakeWhatsNew.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class IntStack
5252
// Line starting with + : Make into bullet
5353
// URLs are converted into <a href>. If you suffix a link with |, the following text will be used as the desc text
5454
// Text "issue %d" is converted into a link into the tracker
55+
// Text "thread %d" or "post %d" is converted into a link into the forum
5556
int GenHtmlWhatsNew(const char* fnIn, const char* fnOut, bool bFullHTML, const char* _url)
5657
{
5758
FILE* pIn;
@@ -220,6 +221,19 @@ int GenHtmlWhatsNew(const char* fnIn, const char* fnOut, bool bFullHTML, const c
220221
iPos--;
221222
}
222223
}
224+
225+
if (strnicmp(&cBuf[iPos], "thread ", 7) == 0 || strnicmp(&cBuf[iPos], "post ", 5) == 0)
226+
{
227+
const int preLen = strchr(&cBuf[iPos], ' ') - &cBuf[iPos] + 1;
228+
int iPost = atol(&cBuf[iPos+preLen]);
229+
if (iPost != 0)
230+
{
231+
fprintf(pOut, "<a href=\"https://forum.cockos.com/showthread.php?%c=%d\">%.*s%d</a>", tolower(cBuf[iPos]), iPost, preLen, &cBuf[iPos], iPost);
232+
iPos += preLen;
233+
while (isalnum(cBuf[iPos++]));
234+
iPos--;
235+
}
236+
}
223237
}
224238
else if (curSection.Top() == URL)
225239
{ // URL

0 commit comments

Comments
 (0)