Fixed date display & posts update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: NexusV6
|
title: NexusV6
|
||||||
tags: Main website, iteration 6
|
tags: typescript pug markdown static site generator
|
||||||
date: 2019-02-01
|
date: 2019-02-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: nexusv6.html
|
url: nexusv6.html
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ git: [git.gltronic.ovh/gltron/NexusV7](https://git.gltronic.ovh/gltron/NexusV7)
|
|||||||
|
|
||||||
app: [gltronic.ovh](https://gltronic.ovh)
|
app: [gltronic.ovh](https://gltronic.ovh)
|
||||||
|
|
||||||
NexusV7 est un générateur de site statique écrit Rust.
|
NexusV7 est un générateur de site statique écrit en Rust.
|
||||||
|
|
||||||
La génération repose sur les templates handlebars & des fichiers markdown contenant des metadata.
|
La génération repose sur les templates handlebars & des fichiers markdown contenant des metadata.
|
||||||
|
|||||||
@@ -29,11 +29,7 @@ impl Post {
|
|||||||
if is_year_only {
|
if is_year_only {
|
||||||
date_printable.push_str(&year.to_string());
|
date_printable.push_str(&year.to_string());
|
||||||
} else {
|
} else {
|
||||||
date_printable.push_str(&day.to_string());
|
date_printable = beautify_date(day, month, year);
|
||||||
date_printable.push_str("-");
|
|
||||||
date_printable.push_str(&month.to_string());
|
|
||||||
date_printable.push_str("-");
|
|
||||||
date_printable.push_str(&year.to_string());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Post {
|
Post {
|
||||||
@@ -67,3 +63,28 @@ fn to_date_number(date: &String) -> (i32, i32, i32) {
|
|||||||
|
|
||||||
return (year, month, day);
|
return (year, month, day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn beautify_date(day: i32, month: i32, year: i32) -> String {
|
||||||
|
let mut date = String::new();
|
||||||
|
if day < 10 {
|
||||||
|
date.push_str("0");
|
||||||
|
date.push_str(&day.to_string());
|
||||||
|
} else {
|
||||||
|
date.push_str(&day.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
date.push_str("-");
|
||||||
|
|
||||||
|
if month < 10 {
|
||||||
|
date.push_str("0");
|
||||||
|
date.push_str(&month.to_string());
|
||||||
|
} else {
|
||||||
|
date.push_str(&month.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
date.push_str("-");
|
||||||
|
|
||||||
|
date.push_str(&year.to_string());
|
||||||
|
|
||||||
|
date
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user