Fix <time> tag validity
Diff
templates/index.html | 2 +-
src/methods/filters.rs | 5 ++++-
templates/repo/macros/refs.html | 6 ++++--
3 files changed, 7 insertions(+), 6 deletions(-)
@@ -44,7 +44,7 @@
</td>
<td>
<a href="/{% if let Some(path) = path %}{{ path }}/{% endif %}{{ repository.name }}">
<time datetime="{{ repository.last_modified }}" title="{{ repository.last_modified }}">
<time datetime="{{ repository.last_modified|format_time }}" title="{{ repository.last_modified|format_time }}">
{{- repository.last_modified.clone()|timeago -}}
</time>
</a>
@@ -1,11 +1,12 @@
#![allow(clippy::unnecessary_wraps, clippy::trivially_copy_pass_by_ref)]
use std::borrow::Borrow;
use time::format_description::well_known::Rfc3339;
pub fn format_time(s: time::OffsetDateTime) -> Result<String, askama::Error> {
s.format(&Rfc3339)
pub fn format_time(s: impl Borrow<time::OffsetDateTime>) -> Result<String, askama::Error> {
(*s.borrow())
.format(&Rfc3339)
.map_err(Box::from)
.map_err(askama::Error::Custom)
}
@@ -18,7 +18,7 @@
{{ commit.get().author.name }}
</td>
<td>
<time datetime="{{ commit.get().author.time }}" title="{{ commit.get().author.time }}">
<time datetime="{{ commit.get().author.time|format_time }}" title="{{ commit.get().author.time|format_time }}">
{{- commit.get().author.time|timeago -}}
</time>
</td>
@@ -50,7 +50,7 @@
</td>
<td>
{% if let Some(tagger) = tag.get().tagger -%}
<time datetime="{{ tagger.time }}" title="{{ tagger.time }}">
<time datetime="{{ tagger.time|format_time }}" title="{{ tagger.time|format_time }}">
{{- tagger.time|timeago -}}
</time>
{%- endif %}
@@ -74,7 +74,7 @@
{% set commit = commit.get() %}
<tr>
<td>
<time datetime="{{ commit.committer.time }}" title="{{ commit.committer.time }}">
<time datetime="{{ commit.committer.time|format_time }}" title="{{ commit.committer.time|format_time }}">
{{- commit.committer.time.clone()|timeago -}}
</time>
</td>