Fixes for @tomasino's requested changes
continuous-integration/drone/pr Build encountered an error Details

This commit is contained in:
Anton McClure 2022-01-26 11:03:57 -05:00
parent 9caa98af17
commit 9676578b5b
Signed by untrusted user: anton
GPG Key ID: 420B5F905BF0567B
1 changed files with 31 additions and 12 deletions

View File

@ -20,9 +20,17 @@ if (file_exists($filename)) {
$yml = $document->getYAML();
$content = $document->getContent();
$title = $yml["title"] ?? "invalid";
$author_name = htmlspecialchars($yml["author-name"]);
$author_link = htmlspecialchars($yml["author-link"]);
$original_link = htmlspecialchars($yml["original"]);
$date = htmlspecialchars($yml["date"]);
$author_name = htmlspecialchars($yml["author_name"]);
if (isset($yml["author_link"])) {
$author_link = htmlspecialchars($yml["author_link"]);
$author = "<a href=\"$author_link\">$author_name</a>";
} else {
$author = $author_name;
}
if (isset($yml["original_link"])):
$original_link = htmlspecialchars($yml["original_link"]);
endif;
$description = "journal entry {$entry_name}: {$yml["title"]} by {$author}";
include __DIR__."/../header.php";
@ -31,14 +39,14 @@ if (file_exists($filename)) {
<a href=".">&lt; back to list</a>
<h1>
<?=$yml["title"]?>
<?=$title?>
<?=$yml["published"] ? "" : " <small><em>draft</em></small>" ?>
</h1>
<p>author: <a href="<?=$author_link?>"><?=$author_name?></a></p>
<p>date: <?=$yml["date"]?></p>
<p>author: <?=$author?></p>
<p>date: <?=$date?></p>
<br />
<?php if ($yml["original"]): ?>
<?php if (isset($original_link)): ?>
<p>Originally published at <a href="<?=$original_link?>"><?=$original_link?></a>.</p>
<br />
<?php endif; ?>
@ -61,11 +69,22 @@ if (file_exists($filename)) {
<h1>journal entries</h1>
<ul>
<?php foreach ($entries as $entry) {
if (!$entry["yml"]["published"]) continue; ?>
if (!$entry["yml"]["published"]) continue;
$title = $entry["yml"]["title"] ?? "invalid";
$date = htmlspecialchars($entry["yml"]["date"]);
$author_name = htmlspecialchars($entry["yml"]["author_name"]);
if (isset($entry["yml"]["author_link"])) {
$author_link = htmlspecialchars($entry["yml"]["author_link"]);
$author = "<a href=\"$author_link\">$author_name</a>";
} else {
$author = $author_name;
} ?>
<li>
<a href="/entries/<?=$entry["slug"]?>"><?=$entry["yml"]["title"]?></a>
<a href="/entries/<?=$entry["slug"]?>"><?=$title?></a>
by
<a href="<?=$entry["yml"]["author-link"]?>"><?=$entry["yml"]["author-name"]?></a>
<?=$author?>
&mdash;
<?=$date?>
</li>
<?php } ?>
</ul>