{% macro news_preview(post) %} {% from 'macros.twig' import container_title %} <div class="container news__preview"> {{ container_title(post.post_title, '/news.php?p=' ~ post.post_id) }} <div class="news__preview__container"> <div class="news__preview__content"> <div class="news__preview__text"> {{ post.post_text|first_paragraph|parse_text(constant('MSZ_PARSER_MARKDOWN'))|raw }} </div> {% if post.user_id is not null %} <a class="news__preview__user" href="/profile.php?u={{ post.user_id }}"> <div class="avatar news__preview__user__avatar" style="background-image:url('/profile.php?u={{ post.user_id }}&m=avatar')"></div> <div class="news__preview__user__name" style="{{ post.user_colour|html_colour }}"> {{ post.username }} </div> </a> {% endif %} </div> <div class="news__preview__info"> <a href="/news.php?p={{ post.post_id }}" class="news__preview__link"> <time class="news__preview__date" datetime="{{ post.post_created|date('c') }}" title="{{ post.post_created|date('r') }}"> {{ post.post_created|time_diff }} </time> </a> <a href="/news.php?p={{ post.post_id }}#comments" class="news__preview__link"> {{ post.post_comments < 1 ? 'No' : post.post_comments|number_format }} comment{{ post.post_comments != 1 ? 's' : '' }} </a> </div> </div> </div> {% endmacro %}