Add microformat tags (#341)

Close #229 
Adding `<div>` might have broken the layout in some places. I've tried to fix it, tell me if I missed it somewhere
This commit is contained in:
fdb-hiroshima
2018-12-08 21:52:46 +01:00
committed by Baptiste Gelez
parent 4182e67dbf
commit e9f2f769be
11 changed files with 108 additions and 66 deletions
+12 -6
View File
@@ -3,15 +3,21 @@
@use plume_models::users::User;
@use routes::*;
@(ctx: BaseContext, comm: &Comment, author: User)
@(ctx: BaseContext, comm: &Comment, author: User, in_reply_to: Option<&str>)
<div class="comment" id="comment-@comm.id">
<a class="author" href="@uri!(user::details: name = author.get_fqn(ctx.0))">
<div class="comment u-comment h-cite" id="comment-@comm.id">
<a class="author u-author h-card" href="@uri!(user::details: name = author.get_fqn(ctx.0))">
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
<span class="display-name">@author.name(ctx.0)</span>
<span class="display-name p-name">@author.name(ctx.0)</span>
<small>@author.get_fqn(ctx.0)</small>
</a>
<div class="text">
@if let Some(ref ap_url) = comm.ap_url {
<a class="u-url" href="@ap_url"></a>
}
@if let Some(ref in_reply_to) = in_reply_to {
<a class="u-in-reply-to" href="@in_reply_to"></a>
}
<div class="text p-content">
@if comm.sensitive {
<details>
<summary>@comm.spoiler_text</summary>
@@ -23,6 +29,6 @@
</div>
<a class="button icon icon-message-circle" href="?responding_to=@comm.id">@i18n!(ctx.1, "Respond")</a>
@for res in comm.get_responses(ctx.0) {
@:comment(ctx, &res, res.get_author(ctx.0))
@:comment(ctx, &res, res.get_author(ctx.0), comm.ap_url.as_ref().map(|u| &**u))
}
</div>
+3 -1
View File
@@ -5,10 +5,12 @@
@(ctx: BaseContext, articles: Vec<Post>, link: &str, title: &str)
@if articles.len() > 0 {
<h2>@i18n!(ctx.1, title) &mdash; <a href="@link">@i18n!(ctx.1, "View all")</a></h2>
<div class="h-feed">
<h2><span class="p-name">@i18n!(ctx.1, title)</span> &mdash; <a href="@link">@i18n!(ctx.1, "View all")</a></h2>
<div class="cards spaced">
@for article in articles {
@:post_card(ctx, article)
}
</div>
</div>
}
+5 -5
View File
@@ -4,22 +4,22 @@
@(ctx: BaseContext, article: Post)
<div class="card">
<div class="card h-entry">
@if article.cover_id.is_some() {
<div class="cover" style="background-image: url('@Html(article.cover_url(ctx.0).unwrap_or_default())')"></div>
}
<h3><a href="@uri!(posts::details: blog = article.get_blog(ctx.0).get_fqn(ctx.0), slug = &article.slug)">@article.title</a></h3>
<h3 class="p-name"><a class="u-url"href="@uri!(posts::details: blog = article.get_blog(ctx.0).get_fqn(ctx.0), slug = &article.slug)">@article.title</a></h3>
<main>
<p>@article.subtitle</p>
<p class="p-summary">@article.subtitle</p>
</main>
<p class="author">
@Html(i18n!(ctx.1, "By {0}"; format!(
"<a href=\"{}\">{}</a>",
"<a class=\"p-author h-card\" href=\"{}\">{}</a>",
uri!(user::details: name = article.get_authors(ctx.0)[0].get_fqn(ctx.0)),
escape(&article.get_authors(ctx.0)[0].name(ctx.0))
)))
@if article.published {
@article.creation_date.format("%B %e, %Y")
<span class="dt-published" datetime="@article.creation_date.format("%F %T")">@article.creation_date.format("%B %e, %Y")</span>
}
<a href="@uri!(blogs::details: name = article.get_blog(ctx.0).get_fqn(ctx.0))">@article.get_blog(ctx.0).title</a>
@if !article.published {