diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-03-04 01:46:45 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-03-04 01:46:45 +0300 |
commit | eeb84c5be16ecca239adae9c851bc0f7db0875a1 (patch) | |
tree | 9aa1056e643212e4c6133d90f38a1966f0fa35ca /skin/main.skin.php | |
parent | 917d2622aa5fe748c1cda914eae94c12be743c42 (diff) |
blog: support ToC
Diffstat (limited to 'skin/main.skin.php')
-rw-r--r-- | skin/main.skin.php | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/skin/main.skin.php b/skin/main.skin.php index a1a4910..c0ab40a 100644 --- a/skin/main.skin.php +++ b/skin/main.skin.php @@ -144,22 +144,28 @@ HTML; // post page // --------- -function post($ctx, $id, $title, $unsafe_html, $date, $visible, $url, $tags, $email, $urlencoded_reply_subject) { +function post($ctx, $id, $title, $unsafe_html, $unsafe_toc_html, $date, $visible, $url, $tags, $email, $urlencoded_reply_subject) { $html = <<<HTML -<div class="blog-post"> - <div class="blog-post-title"> - <h1>{$title}</h1> - <div class="blog-post-date"> - {$ctx->if_not($visible, '<b>'.$ctx->lang('blog_post_hidden').'</b> |')} - {$date} - {$ctx->if_admin($ctx->postAdminLinks, $url, $id)} - </div> - <div class="blog-post-tags clearfix"> - {$ctx->for_each($tags, fn($tag) => $ctx->postTag($tag->getUrl(), $tag->tag))} +<div class="blog-post-wrap2"> + <div class="blog-post-wrap1"> + <div class="blog-post"> + <div class="blog-post-title"> + <h1>{$title}</h1> + <div class="blog-post-date"> + {$ctx->if_not($visible, '<b>'.$ctx->lang('blog_post_hidden').'</b> |')} + {$date} + {$ctx->if_admin($ctx->postAdminLinks, $url, $id)} + </div> + <div class="blog-post-tags clearfix"> + {$ctx->for_each($tags, fn($tag) => $ctx->postTag($tag->getUrl(), $tag->tag))} + </div> + </div> + <div class="blog-post-text">{$unsafe_html}</div> </div> + {$ctx->if_true($unsafe_toc_html, $ctx->postToc, $unsafe_toc_html)} </div> - <div class="blog-post-text">{$unsafe_html}</div> </div> + <div class="blog-post-comments"> {$ctx->langRaw('blog_comments_text', $email, $urlencoded_reply_subject)} </div> @@ -168,6 +174,20 @@ HTML; return [$html, markdownThemeChangeListener()]; } +function postToc($ctx, $unsafe_toc_html) { +return <<<HTML +<div class="blog-post-toc"> + <div class="blog-post-toc-wrap"> + <div class="blog-post-toc-inner-wrap"> + <div class="blog-post-toc-title">{$ctx->lang('toc')}</div> + {$unsafe_toc_html} + </div> + </div> +</div> +HTML; + +} + function postAdminLinks($ctx, $url, $id) { return <<<HTML <a href="{$url}edit/">{$ctx->lang('edit')}</a> |