mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 15:20:32 -04:00
Add link to Github for each commit in an ebooks short commit history
This commit is contained in:
parent
08f707e342
commit
25c40e3e67
3 changed files with 7 additions and 5 deletions
|
@ -124,11 +124,11 @@ class Ebook{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in the short history of this repo.
|
// Fill in the short history of this repo.
|
||||||
$historyEntries = explode("\n", shell_exec('cd ' . escapeshellarg($this->RepoFilesystemPath) . ' && git log -n5 --pretty=format:"%ct %s"') ?? '');
|
$historyEntries = explode("\n", shell_exec('cd ' . escapeshellarg($this->RepoFilesystemPath) . ' && git log -n5 --pretty=format:"%ct %H %s"') ?? '');
|
||||||
|
|
||||||
foreach($historyEntries as $entry){
|
foreach($historyEntries as $entry){
|
||||||
$array = explode(' ', $entry, 2);
|
$array = explode(' ', $entry, 3);
|
||||||
$this->GitCommits[] = new GitCommit($array[0], $array[1]);
|
$this->GitCommits[] = new GitCommit($array[0], $array[1], $array[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get cover image URLs.
|
// Get cover image URLs.
|
||||||
|
|
|
@ -4,9 +4,11 @@ use Safe\DateTimeImmutable;
|
||||||
class GitCommit{
|
class GitCommit{
|
||||||
public $Timestamp;
|
public $Timestamp;
|
||||||
public $Message;
|
public $Message;
|
||||||
|
public $Hash;
|
||||||
|
|
||||||
public function __construct(string $unixTimestamp, string $message){
|
public function __construct(string $unixTimestamp, string $hash, string $message){
|
||||||
$this->Timestamp = new DateTimeImmutable('@' . $unixTimestamp);
|
$this->Timestamp = new DateTimeImmutable('@' . $unixTimestamp);
|
||||||
$this->Message = $message;
|
$this->Message = $message;
|
||||||
|
$this->Hash = $hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ catch(\Exception $ex){
|
||||||
<? foreach($ebook->GitCommits as $commit){ ?>
|
<? foreach($ebook->GitCommits as $commit){ ?>
|
||||||
<li>
|
<li>
|
||||||
<time datetime="<?= $commit->Timestamp->format(DateTime::RFC3339) ?>"><?= $commit->Timestamp->format('M j, Y') ?></time>
|
<time datetime="<?= $commit->Timestamp->format(DateTime::RFC3339) ?>"><?= $commit->Timestamp->format('M j, Y') ?></time>
|
||||||
<p><?= Formatter::ToPlainText($commit->Message) ?></p>
|
<p><a href="<?= Formatter::ToPlainText($ebook->GitHubUrl) ?>/commit/<?= Formatter::ToPlainText($commit->Hash) ?>"><?= Formatter::ToPlainText($commit->Message) ?></a></p>
|
||||||
</li>
|
</li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue