Post date & tags
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Blender 2020
|
title: Blender 2020
|
||||||
description: 2020 blender artworks
|
tags: 2020 blender artworks
|
||||||
date: 2020-01-01
|
date: 2020-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: 2020.html
|
url: 2020.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Blender 2021
|
title: Blender 2021
|
||||||
description: 2021 blender artworks
|
tags: 2021 blender artworks
|
||||||
date: 2021-01-01
|
date: 2021-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: 2021.html
|
url: 2021.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Les sites web perso
|
title: Les sites web perso
|
||||||
description: blog sites perso
|
tags: blog sites perso
|
||||||
date: 2020-01-04
|
date: 2020-01-04
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: les-sites-web-perso.html
|
url: les-sites-web-perso.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: La grande virtualization
|
title: La grande virtualization
|
||||||
description: docker virtualization
|
tags: docker virtualization
|
||||||
date: 2020-01-12
|
date: 2020-01-12
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: la-grande-virtualization.html
|
url: la-grande-virtualization.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Migration gitea vers docker
|
title: Migration gitea vers docker
|
||||||
description: gitea docker
|
tags: gitea docker
|
||||||
date: 2020-03-03
|
date: 2020-03-03
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: migration-gitea-docker.html
|
url: migration-gitea-docker.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Faire une PWA avec VueJS
|
title: Faire une PWA avec VueJS
|
||||||
description: docker vuejs buefy
|
tags: docker vuejs buefy
|
||||||
date: 2020-03-07
|
date: 2020-03-07
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: pwavuejs.html
|
url: pwavuejs.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Sculpter avec Blender
|
title: Sculpter avec Blender
|
||||||
description: sculpt blender 3D
|
tags: sculpt blender 3D
|
||||||
date: 2020-04-19
|
date: 2020-04-19
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: sculptblender.html
|
url: sculptblender.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Les frameworks Javascript
|
title: Les frameworks Javascript
|
||||||
description: javascript framework
|
tags: javascript framework
|
||||||
date: 2020-04-23
|
date: 2020-04-23
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: vanillajs.html
|
url: vanillajs.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Sculpter avec Blender 2
|
title: Sculpter avec Blender 2
|
||||||
description: sculpt blender 3D
|
tags: sculpt blender 3D
|
||||||
date: 2020-06-06
|
date: 2020-06-06
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: sculptblender2.html
|
url: sculptblender2.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Setup Gitea / Drone / Docker
|
title: Setup Gitea / Drone / Docker
|
||||||
description: gitea drone cicd docker
|
tags: gitea drone cicd docker
|
||||||
date: 2021-01-15
|
date: 2021-01-15
|
||||||
yearonly: false
|
yearonly: false
|
||||||
url: giteadronedocker.html
|
url: giteadronedocker.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Initial2D
|
title: Initial2D
|
||||||
description: A simple GTK race game
|
tags: A simple GTK race game
|
||||||
date: 2018-01-01
|
date: 2018-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: initial2D.html
|
url: initial2D.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Oozik
|
title: Oozik
|
||||||
description: Lecteur de musique collaboratif
|
tags: Lecteur de musique collaboratif
|
||||||
date: 2019-01-01
|
date: 2019-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: oozik.html
|
url: oozik.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: NexusV6
|
title: NexusV6
|
||||||
description: Main website, iteration 6
|
tags: Main website, iteration 6
|
||||||
date: 2019-02-01
|
date: 2019-02-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: nexusv6.html
|
url: nexusv6.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Etienne's Remote
|
title: Etienne's Remote
|
||||||
description: Une télécommande de soundboard
|
tags: Une télécommande de soundboard
|
||||||
date: 2020-01-01
|
date: 2020-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: etienneremote.html
|
url: etienneremote.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Cloud32
|
title: Cloud32
|
||||||
description: Un cloud personnel pas pratique
|
tags: Un cloud personnel pas pratique
|
||||||
date: 2020-02-01
|
date: 2020-02-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: cloud32.html
|
url: cloud32.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: LilStreamy
|
title: LilStreamy
|
||||||
description: application web video p2p
|
tags: application web video p2p
|
||||||
date: 2020-03-01
|
date: 2020-03-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: lilstreamy.html
|
url: lilstreamy.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Mozen
|
title: Mozen
|
||||||
description: Bibliothèque de machine learning
|
tags: Bibliothèque de machine learning
|
||||||
date: 2020-04-01
|
date: 2020-04-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: mozen.html
|
url: mozen.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Voozik
|
title: Voozik
|
||||||
description: Application web musique/video p2p
|
tags: Application web musique/video p2p
|
||||||
date: 2020-05-01
|
date: 2020-05-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: voozik.html
|
url: voozik.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Tron.io
|
title: Tron.io
|
||||||
description: Jeu web
|
tags: Jeu web
|
||||||
date: 2020-06-01
|
date: 2020-06-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
url: tronio.html
|
url: tronio.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: NexusV7
|
title: NexusV7
|
||||||
description: Static site generator
|
tags: Static site generator
|
||||||
tags: rust, static site generator
|
tags: rust, static site generator
|
||||||
date: 2021-01-01
|
date: 2021-01-01
|
||||||
yearonly: true
|
yearonly: true
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ fn load_section(dir_entry: &DirEntry) -> Section {
|
|||||||
let section_name = dir_entry.file_name().into_string().unwrap();
|
let section_name = dir_entry.file_name().into_string().unwrap();
|
||||||
let section_url = section_name.to_lowercase().trim().replace(" ", "_");
|
let section_url = section_name.to_lowercase().trim().replace(" ", "_");
|
||||||
|
|
||||||
|
section_posts.sort_by(|a, b| b.date_compare.partial_cmp(&a.date_compare).unwrap());
|
||||||
|
|
||||||
println!("[LOADER] Loaded section {} with {} posts", section_name, section_posts.len());
|
println!("[LOADER] Loaded section {} with {} posts", section_name, section_posts.len());
|
||||||
|
|
||||||
return Section {
|
return Section {
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ use crate::markdown::marky::Marky;
|
|||||||
pub struct Post {
|
pub struct Post {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub date: String,
|
pub date: String,
|
||||||
|
pub date_compare: i32,
|
||||||
|
pub date_printable: String,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub description: String,
|
|
||||||
pub tags: Vec<String>,
|
pub tags: Vec<String>,
|
||||||
pub body: String,
|
pub body: String,
|
||||||
pub is_year_only: bool,
|
pub is_year_only: bool,
|
||||||
@@ -17,11 +18,30 @@ pub struct Post {
|
|||||||
|
|
||||||
impl Post {
|
impl Post {
|
||||||
pub fn from_marky(marky: Marky) -> Post {
|
pub fn from_marky(marky: Marky) -> Post {
|
||||||
|
let date = marky.metadata.get("date").map_or(String::from("none"), String::from);
|
||||||
|
let is_year_only = marky.metadata.get("yearonly").map_or(false, |a| a == "true");
|
||||||
|
|
||||||
|
let (year, month, day) = to_date_number(&date);
|
||||||
|
|
||||||
|
let date_compare = year * 1200 + month * 100 + day;
|
||||||
|
|
||||||
|
let mut date_printable = String::new();
|
||||||
|
if is_year_only {
|
||||||
|
date_printable.push_str(&year.to_string());
|
||||||
|
} else {
|
||||||
|
date_printable.push_str(&day.to_string());
|
||||||
|
date_printable.push_str("-");
|
||||||
|
date_printable.push_str(&month.to_string());
|
||||||
|
date_printable.push_str("-");
|
||||||
|
date_printable.push_str(&year.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
Post {
|
Post {
|
||||||
title: marky.metadata.get("title").map_or(String::from("none"), String::from),
|
title: marky.metadata.get("title").map_or(String::from("none"), String::from),
|
||||||
date: marky.metadata.get("date").map_or(String::from("none"), String::from),
|
date: date,
|
||||||
|
date_compare: date_compare,
|
||||||
|
date_printable: date_printable,
|
||||||
url: marky.metadata.get("url").map_or(String::from("none"), String::from),
|
url: marky.metadata.get("url").map_or(String::from("none"), String::from),
|
||||||
description: marky.metadata.get("description").map_or(String::from("none"), String::from),
|
|
||||||
tags: tags_string_to_vec(marky.metadata.get("tags").map_or(String::from("none"), String::from)),
|
tags: tags_string_to_vec(marky.metadata.get("tags").map_or(String::from("none"), String::from)),
|
||||||
is_year_only: marky.metadata.get("yearonly").map_or(false, |a| a == "true"),
|
is_year_only: marky.metadata.get("yearonly").map_or(false, |a| a == "true"),
|
||||||
body: to_html(&marky.content),
|
body: to_html(&marky.content),
|
||||||
@@ -30,5 +50,20 @@ impl Post {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn tags_string_to_vec(tags: String) -> Vec<String> {
|
fn tags_string_to_vec(tags: String) -> Vec<String> {
|
||||||
return tags.split(",").map(String::from).collect();
|
return tags.split_whitespace().map(String::from).collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert yyyy-MM-dd to yyyy, MM, dd
|
||||||
|
fn to_date_number(date: &String) -> (i32, i32, i32) {
|
||||||
|
let split: Vec<&str> = date.split("-").collect();
|
||||||
|
|
||||||
|
if split.len() == 0 {
|
||||||
|
return (0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
let year = split[0].parse::<i32>().unwrap();
|
||||||
|
let month = split[1].parse::<i32>().unwrap();
|
||||||
|
let day = split[2].parse::<i32>().unwrap();
|
||||||
|
|
||||||
|
return (year, month, day);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
<div class="contentContainer">
|
<div class="contentContainer">
|
||||||
<article>
|
<article>
|
||||||
<h1>{{post.title}}</h1>
|
<h1>{{post.title}}</h1>
|
||||||
<h5>{{post.date}}</h5>
|
<h5>
|
||||||
|
{{#each post.tags}}
|
||||||
|
<span>{{this}}</span>
|
||||||
|
{{/each}}
|
||||||
|
</h5>
|
||||||
|
<h5>{{post.date_printable}}</h5>
|
||||||
<hr/>
|
<hr/>
|
||||||
{{{post.body}}}
|
{{{post.body}}}
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
{{#each section.posts}}
|
{{#each section.posts}}
|
||||||
<a href="{{this.url}}">
|
<a href="{{this.url}}">
|
||||||
<span class="postTitle">{{this.title}}</span>
|
<span class="postTitle">{{this.title}}</span>
|
||||||
<span class="postDate">{{this.date}}</span>
|
<span class="postDate">{{this.date_printable}}</span>
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user