Change: Use Markdown for changelog.

Includes minor changes to how version changes are limited for display.
This commit is contained in:
Peter Nelson 2024-10-13 20:20:48 +01:00 committed by Peter Nelson
parent e98407973f
commit 01807fa753
8 changed files with 501 additions and 462 deletions

View File

@ -5,8 +5,8 @@ tag=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\
# If we are a tag, show the part of the changelog till (but excluding) the last stable
if [ -n "$tag" ]; then
grep='^[0-9]\+\.[0-9]\+[^-]'
next=$(cat changelog.txt | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
cat changelog.txt | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
next=$(cat changelog.md | grep '^[0-9]' | awk 'BEGIN { show="false" } // { if (show=="true") print $0; if ($1=="'$tag'") show="true"} ' | grep "$grep" | head -n1 | sed 's/ .*//')
cat changelog.md | awk 'BEGIN { show="false" } /^[0-9]+.[0-9]+/ { if ($1=="'$next'") show="false"; if ($1=="'$tag'") show="true";} // { if (show=="true") print $0 }'
exit 0
fi

View File

@ -127,7 +127,7 @@ jobs:
fi
mkdir -p build/bundles
cp .changelog build/bundles/changelog.txt
cp .changelog build/bundles/changelog.md
cp .release_date build/bundles/released.txt
cp README.md build/bundles/README.md
echo "::endgroup::"

View File

@ -389,7 +389,7 @@ if(EMSCRIPTEN)
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/CONTRIBUTING.md@/CONTRIBUTING.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/COPYING.md@/COPYING.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/known-bugs.md@/known-bugs.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/changelog.txt@/changelog.txt")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/changelog.md@/changelog.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/admin_network.md@/docs/admin_network.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/debugging_desyncs.md@/docs/debugging_desyncs.md")
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/desync.md@/docs/desync.md")

View File

@ -482,7 +482,7 @@ Do not mention two keywords; if two apply, pick one that best represents the com
The `<details>` part starts with a capital and does not end with a dot.
Try to be descriptive to what the player will notice, not to what is actually being changed in the code.
See `changelog.txt` for inspiration.
See `changelog.md` for inspiration.
To further structure the changelog, you can add components. Example are:
* "Network" for network specific changes.

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ install(FILES
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/CREDITS.md
${CMAKE_SOURCE_DIR}/CONTRIBUTING.md
${CMAKE_SOURCE_DIR}/changelog.txt
${CMAKE_SOURCE_DIR}/changelog.md
${CMAKE_SOURCE_DIR}/known-bugs.md
DESTINATION ${DOCS_DESTINATION_DIR}
COMPONENT docs)

View File

@ -20,7 +20,7 @@ This guide is for OpenTTD developers/maintainers, to release a new version of Op
## Step 1: Prepare changelog documentation
1. Update the [changelog](../changelog.txt) with new changes since the last release.
1. Update the [changelog](../changelog.md) with new changes since the last release.
* Changelog entries are typically PR titles, but can be edited to be more helpful without context.
* Don't include fixes to things which haven't previously been released (like fixes to features which are in the same changelog).
* Order the entries by importance: `Feature > Add > Change > Fix`, then numerically by PR number.

View File

@ -23,7 +23,7 @@
#include "safeguards.h"
static const std::string README_FILENAME = "README.md";
static const std::string CHANGELOG_FILENAME = "changelog.txt";
static const std::string CHANGELOG_FILENAME = "changelog.md";
static const std::string KNOWN_BUGS_FILENAME = "known-bugs.md";
static const std::string LICENSE_FILENAME = "COPYING.md";
@ -87,33 +87,30 @@ struct GameManualTextfileWindow : public TextfileWindow {
if (this->filename == CHANGELOG_FILENAME) {
this->link_anchors.clear();
this->AfterLoadChangelog();
if (this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(this->jumplist.empty() ? SZSP_HORIZONTAL : 0)) this->ReInit();
} else {
this->TextfileWindow::AfterLoadText();
}
this->TextfileWindow::AfterLoadText();
}
/**
* For changelog files, add a jumplist entry for each version.
* For changelog files, truncate the file after CHANGELOG_VERSIONS_LIMIT versions.
*
* This is hardcoded and assumes "---" are used to separate versions.
* This is hardcoded and assumes "###" is used to separate versions.
*/
void AfterLoadChangelog()
{
/* Look for lines beginning with ---, they indicate that the previous line was a release name. */
uint versions = 0;
/* Look for lines beginning with ###, they indicate a release name. */
for (size_t line_index = 0; line_index < this->lines.size(); ++line_index) {
const Line &line = this->lines[line_index];
if (line.text.find("---", 0) != 0) continue;
if (!line.text.starts_with("###")) continue;
if (this->jumplist.size() >= CHANGELOG_VERSIONS_LIMIT) {
if (versions >= CHANGELOG_VERSIONS_LIMIT) {
this->lines.resize(line_index - 2);
break;
}
/* Mark the version header with a colour, and add it to the jumplist. */
this->lines[line_index - 1].colour = TC_GOLD;
this->lines[line_index].colour = TC_GOLD;
this->jumplist.push_back(line_index - 1);
++versions;
}
}
};