docs(changelog): add keep a changelog note

This commit is contained in:
grandeljay 2023-12-19 15:26:39 +01:00
parent 1f26f19315
commit d99762305b
2 changed files with 23 additions and 8 deletions

5
changelogs/changelog.md Normal file
View file

@ -0,0 +1,5 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View file

@ -12,25 +12,36 @@ $page = new Page(__FILE__, __('Changelog'));
$page->header(); $page->header();
$page->bodyStart(); $page->bodyStart();
$page->navigation(); $page->navigation();
$parsedown = new \Parsedown();
$changelogsDirectory = ROOT . '/changelogs';
$changelogFilepath = $changelogsDirectory . '/changelog.md';
?> ?>
<main> <main>
<div class="ui container"> <div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment">
<?= $parsedown->text(\file_get_contents($changelogFilepath)); ?>
</div>
<div class="ui stackable grid"> <div class="ui stackable grid">
<?php <?php
$changelogsDirectory = ROOT . '/changelogs'; $changelogs = \scandir($changelogsDirectory, \SCANDIR_SORT_DESCENDING);
$changelogs = \scandir($changelogsDirectory, \SCANDIR_SORT_DESCENDING); $changelogs = \array_map(
$changelogs = \array_map( function (string $filename) use ($changelogsDirectory, $changelogFilepath) {
function (string $filename) use ($changelogsDirectory) {
$filepath = $changelogsDirectory . '/' . $filename; $filepath = $changelogsDirectory . '/' . $filename;
if ($filepath === $changelogFilepath) {
return false;
}
return $filepath; return $filepath;
}, },
$changelogs $changelogs
); );
$changelogs = \array_filter($changelogs, '\is_file'); $changelogs = \array_filter($changelogs, '\is_file');
?> ?>
<div class="four wide column"> <div class="four wide column">
@ -56,9 +67,8 @@ $page->navigation();
<div class="ui tab" data-tab="<?= $filenameSanitised ?>"> <div class="ui tab" data-tab="<?= $filenameSanitised ?>">
<div class="ui segments"> <div class="ui segments">
<?php <?php
$parsedown = new \Parsedown(); $text = \file_get_contents($filepath);
$text = \file_get_contents($filepath); $text = \preg_replace('/(#(\d+))/', '<a href="https://github.com/wishthis/wishthis/issues/$2">$1</a>', $text);
$text = \preg_replace('/(#(\d+))/', '<a href="https://github.com/wishthis/wishthis/issues/$2">$1</a>', $text);
?> ?>
<div class="ui segment"><?= $parsedown->text($text); ?></div> <div class="ui segment"><?= $parsedown->text($text); ?></div>
</div> </div>