From 3e3c14ce595140102f0b66383e53abc9017866cf Mon Sep 17 00:00:00 2001 From: "E. S." Date: Fri, 15 Mar 2024 23:38:59 +0000 Subject: [PATCH] posts: add links to source to kiwi arxiv --- handler/MainHandler.php | 1 + lib/posts.php | 1 + skin/main.phps | 8 +++----- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/handler/MainHandler.php b/handler/MainHandler.php index 71a0772..1a6ba11 100644 --- a/handler/MainHandler.php +++ b/handler/MainHandler.php @@ -112,6 +112,7 @@ class MainHandler extends request_handler { render('main/post', title: $pt->title, id: $post->id, + source_url: $post->sourceUrl, unsafe_html: $pt->getHtml(is_retina(), getUserTheme()), unsafe_toc_html: $pt->getTableOfContentsHtml(), date: $post->getFullDate(), diff --git a/lib/posts.php b/lib/posts.php index 462168e..5c8aecf 100644 --- a/lib/posts.php +++ b/lib/posts.php @@ -17,6 +17,7 @@ class Post extends model { public string $date; public bool $visible; public string $shortName; + public string $sourceUrl; protected array $texts = []; diff --git a/skin/main.phps b/skin/main.phps index 4144965..00123ac 100644 --- a/skin/main.phps +++ b/skin/main.phps @@ -135,9 +135,6 @@ function articles_right_link($ctx, $url, string $label, int $index) { function page($ctx, $page_url, $short_name, $unsafe_html) { $html = << - {$ctx->if_admin($ctx->page_admin_links, $page_url, $short_name)}
{$unsafe_html}
@@ -160,7 +157,7 @@ HTML; // post page // --------- -function post($ctx, $id, $title, $unsafe_html, $unsafe_toc_html, $date, $visible, $url, string $lang, $other_langs) { +function post($ctx, $id, $title, $unsafe_html, $unsafe_toc_html, $date, $visible, $url, string $lang, $other_langs, string $source_url) { $html = <<
@@ -173,7 +170,8 @@ $html = << {$ctx->if_not($visible, $ctx->lang('blog_post_hidden').' |')} {$date} - {$ctx->if_true($other_langs, $ctx->post_other_langs($url, $other_langs))} + {$ctx->if_true($other_langs, fn() => $ctx->post_other_langs($url, $other_langs))} + {$ctx->if_true($source_url, fn() => ' | Source at kiwiarxiv')} {$ctx->if_admin($ctx->post_admin_links, $url, $id, $lang)}