Skip to content

Commit

Permalink
Remove opt_data filter
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 19, 2024
1 parent 9f9efb6 commit a3a57a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 0 additions & 8 deletions src/web/page/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,6 @@ pub mod filters {
Ok(((multiplier * *value).round() / multiplier).to_string())
}

pub fn opt_date(value: &Option<DateTime<Utc>>, format: &str) -> rinja::Result<String> {
if let Some(value) = value {
Ok(value.format(format).to_string())
} else {
Ok(String::new())
}
}

pub fn split_first<'a>(value: &'a str, pat: &str) -> rinja::Result<Option<&'a str>> {
Ok(value.split(pat).next())
}
Expand Down
10 changes: 8 additions & 2 deletions templates/releases/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<id>urn:docs-rs:{{ crate::BUILD_VERSION }}</id>
<updated>
{%- if let Some(first_release) = recent_releases.get(0) -%}
{{ first_release.build_time|opt_date("%+") }}
{%- if let Some(build_time) = first_release.build_time -%}
{{ build_time.format("%+") }}
{%- endif -%}
{%- endif -%}
</updated>

Expand All @@ -28,7 +30,11 @@

<link href="{{ link|safe }}" />
<id>urn:docs-rs:{{ release.name }}:{{ release.version }}</id>
<updated>{{ release.build_time|opt_date("%+") }}</updated>
<updated>
{% if let Some(build_time) = release.build_time -%}
{{ build_time.format("%+") }}
{%- endif -%}
</updated>

<summary>
{%- if let Some(description) = release.description -%}
Expand Down

0 comments on commit a3a57a1

Please sign in to comment.