Compare commits
8 commits
svg-select
...
main
Author | SHA1 | Date | |
---|---|---|---|
fed97a269b | |||
f725318f56 | |||
77c140a889 | |||
017f04c15e | |||
ca12c5c467 | |||
e699d3cbac | |||
07cd3b1ed4 | |||
c523993ba5 |
29 changed files with 302 additions and 136 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -7,13 +7,13 @@ docker-compose.yml
|
|||
/.vscode
|
||||
|
||||
# Data
|
||||
data/index.md
|
||||
data/index*.md
|
||||
|
||||
data/contacts/*
|
||||
data/cours/*
|
||||
data/projects/*
|
||||
|
||||
# Blog
|
||||
data/blog/*.md
|
||||
data/blog/about*.md
|
||||
data/blog/posts/*
|
||||
!data/blog/posts/Makefile
|
||||
|
|
154
Cargo.lock
generated
154
Cargo.lock
generated
|
@ -85,7 +85,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -199,7 +199,7 @@ dependencies = [
|
|||
"actix-router",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -346,9 +346,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.94"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
|
||||
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
|
@ -364,14 +364,14 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atom_syndication"
|
||||
version = "0.12.5"
|
||||
version = "0.12.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ee79fb83c725eae67b55218870813d2fc39fd85e4f1583848ef9f4f823cfe7c"
|
||||
checksum = "ec03a6e158ee0f38bfba811976ae909bc2505a4a2f4049c7e8df47df3497b119"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"derive_builder",
|
||||
|
@ -507,7 +507,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -607,7 +607,7 @@ dependencies = [
|
|||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -628,9 +628,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.4"
|
||||
version = "1.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf"
|
||||
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
@ -706,7 +706,7 @@ dependencies = [
|
|||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -723,9 +723,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
|||
|
||||
[[package]]
|
||||
name = "comrak"
|
||||
version = "0.31.0"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453dcb42e33f7b474d7e0db12e0b8d82802c88f35cf5a1d8c297d0dfcecb154f"
|
||||
checksum = "48ae8f3e7e3f3d424cbb33354fc36943d507327d210aa5794b0192f4be726c6d"
|
||||
dependencies = [
|
||||
"bon",
|
||||
"caseless",
|
||||
|
@ -813,9 +813,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
|
||||
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
|
@ -832,9 +832,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.20"
|
||||
version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
|
@ -892,7 +892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -922,7 +922,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -933,7 +933,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
|||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -991,7 +991,7 @@ dependencies = [
|
|||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1001,7 +1001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1014,7 +1014,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1050,7 +1050,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1089,6 +1089,29 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"env_filter",
|
||||
"humantime",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
|
@ -1117,6 +1140,7 @@ dependencies = [
|
|||
"chrono-tz",
|
||||
"comrak",
|
||||
"cyborgtime",
|
||||
"env_logger",
|
||||
"glob",
|
||||
"lol_html",
|
||||
"mime_guess",
|
||||
|
@ -1168,9 +1192,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2"
|
||||
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
|
@ -1445,10 +1469,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.5.1"
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
|
@ -1466,9 +1496,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.3"
|
||||
version = "0.27.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
|
||||
checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"http 1.2.0",
|
||||
|
@ -1654,7 +1684,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1772,9 +1802,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.168"
|
||||
version = "0.2.169"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
|
||||
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||
|
||||
[[package]]
|
||||
name = "libyml"
|
||||
|
@ -1897,7 +1927,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"regex-syntax",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2010,9 +2040,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.0"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||
checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
|
@ -2075,9 +2105,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.5"
|
||||
version = "0.36.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
|
||||
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -2133,7 +2163,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2351,7 +2381,7 @@ dependencies = [
|
|||
"phf_shared 0.11.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2431,7 +2461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2545,7 +2575,7 @@ dependencies = [
|
|||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2937,9 +2967,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.12.1"
|
||||
version = "2.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2"
|
||||
checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
|
@ -2988,14 +3018,14 @@ checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.133"
|
||||
version = "1.0.134"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
|
||||
checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d"
|
||||
dependencies = [
|
||||
"itoa 1.0.14",
|
||||
"memchr",
|
||||
|
@ -3174,9 +3204,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.90"
|
||||
version = "2.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3200,7 +3230,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3299,7 +3329,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3345,9 +3375,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.8.0"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
|
||||
checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
@ -3384,7 +3414,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3654,7 +3684,7 @@ dependencies = [
|
|||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -3689,7 +3719,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -3915,7 +3945,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -3937,7 +3967,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3957,7 +3987,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -3986,5 +4016,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.91",
|
||||
]
|
||||
|
|
|
@ -21,7 +21,7 @@ serde_json = "1.0"
|
|||
minify-html = "0.15"
|
||||
minify-js = "0.6"
|
||||
glob = "0.3"
|
||||
comrak = "0.31"
|
||||
comrak = "0.32"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
chrono = { version = "0.4.39", default-features = false, features = ["clock"]}
|
||||
chrono-tz = "0.10"
|
||||
|
@ -33,6 +33,7 @@ urlencoding = "2.1"
|
|||
regex = "1.11"
|
||||
cyborgtime = "2.1.1"
|
||||
walkdir = "2.5"
|
||||
env_logger = "0.11"
|
||||
|
||||
[lints.clippy]
|
||||
pedantic = "warn"
|
||||
|
|
|
@ -145,6 +145,8 @@ Markdown file
|
|||
|
||||
Markdown file is stored in `/app/data/index.md`
|
||||
|
||||
> For french clients, `/app/data/index-fr.md` will be read instead.
|
||||
|
||||
```
|
||||
---
|
||||
name: Option<String>
|
||||
|
@ -188,6 +190,8 @@ Post content
|
|||
|
||||
The file is stored at `/app/data/blog/about.md`.
|
||||
|
||||
> For french clients, `/app/data/blog/about-fr.md` will be read instead.
|
||||
|
||||
## Projects
|
||||
|
||||
Markdown files are stored in `/app/data/projects/apps/`
|
||||
|
@ -214,6 +218,8 @@ files in `archive` subdirectory of `apps`.
|
|||
|
||||
The file is stored at `/app/data/projects/about.md`.
|
||||
|
||||
> For french clients, `/app/data/projects/about-fr.md` will be read instead.
|
||||
|
||||
## Contacts
|
||||
|
||||
Markdown files are stored in `/app/data/contacts/`
|
||||
|
@ -254,6 +260,8 @@ For example, `socials` contact files are stored in `/app/data/contacts/socials/`
|
|||
|
||||
The file is stored at `/app/data/contacts/about.md`.
|
||||
|
||||
> For french clients, `/app/data/contacts/about-fr.md` will be read instead.
|
||||
|
||||
## Courses
|
||||
|
||||
Markdown files are stored in `/app/data/cours/`
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{fs::File, io::Write, path::Path};
|
|||
use crate::template::Template;
|
||||
|
||||
/// Store the configuration of config/config.toml
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Hash, PartialEq, Eq)]
|
||||
pub struct FileConfiguration {
|
||||
/// http/https
|
||||
pub scheme: Option<String>,
|
||||
|
@ -75,14 +75,14 @@ impl FileConfiguration {
|
|||
}
|
||||
|
||||
// Paths where files are stored
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub struct Locations {
|
||||
pub static_dir: String,
|
||||
pub data_dir: String,
|
||||
}
|
||||
|
||||
/// Configuration used internally in the app
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub struct Config {
|
||||
/// Information given in the config file
|
||||
pub fc: FileConfiguration,
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
use actix_files::Files;
|
||||
use actix_web::{
|
||||
middleware::{Compress, DefaultHeaders},
|
||||
middleware::{Compress, DefaultHeaders, Logger},
|
||||
web, App, HttpServer,
|
||||
};
|
||||
use std::io::Result;
|
||||
|
@ -29,16 +29,12 @@ async fn main() -> Result<()> {
|
|||
config.fc.port.unwrap(),
|
||||
);
|
||||
|
||||
println!(
|
||||
"Listening to {}://{}:{}",
|
||||
config.clone().fc.scheme.unwrap(),
|
||||
addr.0,
|
||||
addr.1
|
||||
);
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(web::Data::new(config.clone()))
|
||||
.wrap(Logger::default().log_target(config.fc.app_name.clone().unwrap_or_default()))
|
||||
.wrap(Compress::default())
|
||||
.wrap(
|
||||
DefaultHeaders::new()
|
||||
|
|
|
@ -29,6 +29,7 @@ fn build_securitytxt(config: Config) -> String {
|
|||
pref_lang: config.fc.lang.unwrap_or_default(),
|
||||
},
|
||||
InfosPage::default(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -56,6 +57,7 @@ fn build_humanstxt(config: Config) -> String {
|
|||
name: config.fc.fullname.unwrap_or_default(),
|
||||
},
|
||||
InfosPage::default(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -95,5 +97,6 @@ fn build_webmanifest(config: Config) -> String {
|
|||
url: get_url(config.fc),
|
||||
},
|
||||
InfosPage::default(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use actix_web::{get, http::header::ContentType, routes, web, HttpResponse, Responder};
|
||||
use cached::proc_macro::once;
|
||||
use actix_web::{
|
||||
get, http::header::ContentType, routes, web, HttpRequest, HttpResponse, Responder,
|
||||
};
|
||||
use cached::proc_macro::cached;
|
||||
use ramhorns::Content;
|
||||
|
||||
use crate::{
|
||||
|
@ -8,14 +10,17 @@ use crate::{
|
|||
utils::{
|
||||
markdown::{File, FilePath},
|
||||
metadata::MType,
|
||||
misc::{make_kw, read_file, Html},
|
||||
misc::{lang, make_kw, read_file_fallback, Html, Lang},
|
||||
routes::blog::{build_rss, get_post, get_posts, Post, BLOG_DIR, MIME_TYPE_RSS, POST_DIR},
|
||||
},
|
||||
};
|
||||
|
||||
#[get("/blog")]
|
||||
pub async fn index(config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_index(config.get_ref().to_owned()))
|
||||
pub async fn index(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_index(
|
||||
config.get_ref().to_owned(),
|
||||
lang(req.headers()),
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Content, Debug)]
|
||||
|
@ -26,18 +31,19 @@ struct BlogIndexTemplate {
|
|||
no_posts: bool,
|
||||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
fn build_index(config: Config) -> String {
|
||||
#[cached(time = 60)]
|
||||
fn build_index(config: Config, lang: Lang) -> String {
|
||||
let blog_dir = format!("{}/{}", config.locations.data_dir, BLOG_DIR);
|
||||
let mut posts = get_posts(&format!("{blog_dir}/{POST_DIR}"));
|
||||
|
||||
// Get about
|
||||
let about: Option<File> = read_file(
|
||||
let (about, html_lang) = read_file_fallback(
|
||||
FilePath {
|
||||
base: blog_dir,
|
||||
path: "about.md".to_owned(),
|
||||
},
|
||||
MType::Generic,
|
||||
&lang,
|
||||
);
|
||||
|
||||
// Sort from newest to oldest
|
||||
|
@ -63,6 +69,7 @@ fn build_index(config: Config) -> String {
|
|||
)),
|
||||
kw: Some(make_kw(&["blog", "blogging"])),
|
||||
},
|
||||
Some(html_lang),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -101,6 +108,7 @@ fn build_post(file: &str, config: Config) -> String {
|
|||
toc,
|
||||
},
|
||||
infos,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use actix_web::{get, routes, web, HttpRequest, Responder};
|
||||
use cached::proc_macro::once;
|
||||
use cached::proc_macro::cached;
|
||||
use ramhorns::Content;
|
||||
|
||||
use crate::{
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||
utils::{
|
||||
markdown::{File, FilePath},
|
||||
metadata::MType,
|
||||
misc::{make_kw, read_file, Html},
|
||||
misc::{lang, make_kw, read_file_fallback, Html, Lang},
|
||||
routes::contact::{find_links, read, remove_paragraphs},
|
||||
},
|
||||
};
|
||||
|
@ -28,8 +28,8 @@ pub fn pages(cfg: &mut web::ServiceConfig) {
|
|||
}
|
||||
|
||||
#[get("")]
|
||||
async fn page(config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned()))
|
||||
async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned(), lang(req.headers())))
|
||||
}
|
||||
|
||||
#[routes]
|
||||
|
@ -78,18 +78,19 @@ struct NetworksTemplate {
|
|||
others: Vec<File>,
|
||||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
fn build_page(config: Config) -> String {
|
||||
#[cached(time = 60)]
|
||||
fn build_page(config: Config, lang: Lang) -> String {
|
||||
let contacts_dir = format!("{}/{}", config.locations.data_dir, CONTACT_DIR);
|
||||
let ext = ".md";
|
||||
|
||||
// Get about
|
||||
let about = read_file(
|
||||
let (about, html_lang) = read_file_fallback(
|
||||
FilePath {
|
||||
base: contacts_dir.clone(),
|
||||
path: "about.md".to_owned(),
|
||||
},
|
||||
MType::Generic,
|
||||
&lang,
|
||||
);
|
||||
|
||||
let mut socials = read(&FilePath {
|
||||
|
@ -138,5 +139,6 @@ fn build_page(config: Config) -> String {
|
|||
"linktree",
|
||||
])),
|
||||
},
|
||||
Some(html_lang),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -87,5 +87,6 @@ async fn build_page(config: Config) -> String {
|
|||
"code",
|
||||
])),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -60,13 +60,14 @@ fn get_content(
|
|||
path: filename.to_owned(),
|
||||
},
|
||||
MType::Cours,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn build_page(info: &web::Query<PathRequest>, config: Config) -> String {
|
||||
let cours_dir = "data/cours";
|
||||
|
||||
let (ep, el): (_, Vec<String>) = config
|
||||
let (ep, el): (_, Vec<_>) = config
|
||||
.fc
|
||||
.exclude_courses
|
||||
.unwrap()
|
||||
|
@ -106,5 +107,6 @@ fn build_page(info: &web::Query<PathRequest>, config: Config) -> String {
|
|||
"digital garden",
|
||||
])),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use actix_web::{get, web, Responder};
|
||||
use cached::proc_macro::once;
|
||||
use actix_web::{get, web, HttpRequest, Responder};
|
||||
use cached::proc_macro::cached;
|
||||
use ramhorns::Content;
|
||||
|
||||
use crate::{
|
||||
|
@ -8,13 +8,13 @@ use crate::{
|
|||
utils::{
|
||||
markdown::{File, FilePath},
|
||||
metadata::MType,
|
||||
misc::{make_kw, read_file, Html},
|
||||
misc::{lang, make_kw, read_file, read_file_fallback, Html, Lang},
|
||||
},
|
||||
};
|
||||
|
||||
#[get("/")]
|
||||
pub async fn page(config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned()))
|
||||
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned(), lang(req.headers())))
|
||||
}
|
||||
|
||||
#[derive(Content, Debug)]
|
||||
|
@ -34,14 +34,15 @@ struct StyleAvatar {
|
|||
square: bool,
|
||||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
fn build_page(config: Config) -> String {
|
||||
let mut file = read_file(
|
||||
#[cached(time = 60)]
|
||||
fn build_page(config: Config, lang: Lang) -> String {
|
||||
let (mut file, html_lang) = read_file_fallback(
|
||||
FilePath {
|
||||
base: config.locations.data_dir,
|
||||
base: config.locations.data_dir.clone(),
|
||||
path: "index.md".to_owned(),
|
||||
},
|
||||
MType::Index,
|
||||
&lang,
|
||||
);
|
||||
|
||||
// Default values
|
||||
|
@ -77,6 +78,7 @@ fn build_page(config: Config) -> String {
|
|||
path: "README.md".to_owned(),
|
||||
},
|
||||
MType::Generic,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -99,5 +101,6 @@ fn build_page(config: Config) -> String {
|
|||
desc: Some("Page principale".into()),
|
||||
kw: Some(make_kw(&["index", "étudiant", "accueil"])),
|
||||
},
|
||||
Some(html_lang),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -32,5 +32,6 @@ fn build_page(config: Config) -> String {
|
|||
desc: Some("Une page perdu du web".into()),
|
||||
..InfosPage::default()
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use actix_web::{get, web, Responder};
|
||||
use cached::proc_macro::once;
|
||||
use actix_web::{get, web, HttpRequest, Responder};
|
||||
use cached::proc_macro::cached;
|
||||
use glob::glob;
|
||||
use ramhorns::Content;
|
||||
|
||||
|
@ -9,13 +9,13 @@ use crate::{
|
|||
utils::{
|
||||
markdown::{File, FilePath},
|
||||
metadata::MType,
|
||||
misc::{make_kw, read_file, Html},
|
||||
misc::{lang, make_kw, read_file, read_file_fallback, Html, Lang},
|
||||
},
|
||||
};
|
||||
|
||||
#[get("/portfolio")]
|
||||
pub async fn page(config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned()))
|
||||
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned(), lang(req.headers())))
|
||||
}
|
||||
|
||||
#[derive(Content, Debug)]
|
||||
|
@ -29,8 +29,8 @@ struct PortfolioTemplate<'a> {
|
|||
err_msg: &'a str,
|
||||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
fn build_page(config: Config) -> String {
|
||||
#[cached(time = 60)]
|
||||
fn build_page(config: Config, lang: Lang) -> String {
|
||||
let projects_dir = format!("{}/projects", config.locations.data_dir);
|
||||
let apps_dir = FilePath {
|
||||
base: format!("{projects_dir}/apps"),
|
||||
|
@ -39,12 +39,13 @@ fn build_page(config: Config) -> String {
|
|||
let ext = ".md";
|
||||
|
||||
// Get about
|
||||
let about = read_file(
|
||||
let (about, html_lang) = read_file_fallback(
|
||||
FilePath {
|
||||
base: projects_dir,
|
||||
path: "about.md".to_owned(),
|
||||
},
|
||||
MType::Generic,
|
||||
&lang,
|
||||
);
|
||||
|
||||
// Get apps
|
||||
|
@ -54,6 +55,7 @@ fn build_page(config: Config) -> String {
|
|||
read_file(
|
||||
apps_dir.from(&e.unwrap().to_string_lossy()),
|
||||
MType::Portfolio,
|
||||
None,
|
||||
)
|
||||
.unwrap()
|
||||
})
|
||||
|
@ -72,6 +74,7 @@ fn build_page(config: Config) -> String {
|
|||
read_file(
|
||||
apps_dir.from(&e.unwrap().to_string_lossy()),
|
||||
MType::Portfolio,
|
||||
None,
|
||||
)
|
||||
.unwrap()
|
||||
})
|
||||
|
@ -112,5 +115,6 @@ fn build_page(config: Config) -> String {
|
|||
"code",
|
||||
])),
|
||||
},
|
||||
Some(html_lang),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,5 +22,6 @@ fn build_page(config: Config) -> String {
|
|||
desc: Some("Coin reculé de l'internet".into()),
|
||||
kw: Some(make_kw(&["web3", "blockchain", "nft", "ai"])),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use ramhorns::{Content, Ramhorns};
|
||||
|
||||
use crate::utils::misc::Lang;
|
||||
|
||||
/// Structure used in the config variable of the app
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub struct Template {
|
||||
/// Root directory where templates are stored
|
||||
pub directory: String,
|
||||
|
@ -51,12 +53,20 @@ struct DataPage<T> {
|
|||
page_kw: Option<String>,
|
||||
/// Author's name
|
||||
page_author: Option<String>,
|
||||
/// Language used
|
||||
lang: String,
|
||||
/// Data needed to render the page
|
||||
data: T,
|
||||
}
|
||||
|
||||
impl Template {
|
||||
pub fn render<C: Content>(&self, template: &str, data: C, info: InfosPage) -> String {
|
||||
pub fn render<C: Content>(
|
||||
&self,
|
||||
template: &str,
|
||||
data: C,
|
||||
info: InfosPage,
|
||||
lang: Option<String>,
|
||||
) -> String {
|
||||
let mut templates: Ramhorns = Ramhorns::lazy(&self.directory).unwrap();
|
||||
let tplt = templates.from_file(template).unwrap();
|
||||
|
||||
|
@ -67,6 +77,7 @@ impl Template {
|
|||
page_desc: info.desc,
|
||||
page_kw: info.kw,
|
||||
page_author: self.name.clone(),
|
||||
lang: lang.unwrap_or(Lang::default()),
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ impl FilePath {
|
|||
}
|
||||
|
||||
/// Options used for parser and compiler MD --> HTML
|
||||
pub fn get_options(path: Option<FilePath>, metadata_type: MType) -> ComrakOptions {
|
||||
pub fn get_options(path: Option<FilePath>, metadata_type: MType) -> ComrakOptions<'static> {
|
||||
comrak::Options {
|
||||
extension: comrak::ExtensionOptions::builder()
|
||||
.strikethrough(true)
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
use std::{fs, path::Path};
|
||||
use std::{fs, os::unix::fs::MetadataExt, path::Path};
|
||||
|
||||
use actix_web::{
|
||||
http::header::{self, ContentType, TryIntoHeaderValue},
|
||||
http::StatusCode,
|
||||
http::{
|
||||
header::{self, ContentType, HeaderMap, TryIntoHeaderValue},
|
||||
StatusCode,
|
||||
},
|
||||
HttpRequest, HttpResponse, Responder,
|
||||
};
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use cached::proc_macro::cached;
|
||||
use mime_guess::mime;
|
||||
use reqwest::Client;
|
||||
|
||||
use crate::config::FileConfiguration;
|
||||
|
@ -55,21 +58,59 @@ impl Responder for Html {
|
|||
}
|
||||
}
|
||||
|
||||
/// Read a file localized, fallback to default file if localized file isn't found
|
||||
pub fn read_file_fallback(
|
||||
filename: FilePath,
|
||||
expected_file: MType,
|
||||
lang: &Lang,
|
||||
) -> (Option<File>, String) {
|
||||
match read_file(filename.clone(), expected_file, Some(lang.clone())) {
|
||||
None => (
|
||||
read_file(filename, expected_file, None),
|
||||
Lang::English.to_string(),
|
||||
),
|
||||
data => (data, lang.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Read a file
|
||||
pub fn read_file(filename: FilePath, expected_file: MType) -> Option<File> {
|
||||
reader(filename, expected_file)
|
||||
pub fn read_file(filename: FilePath, expected_file: MType, lang: Option<Lang>) -> Option<File> {
|
||||
reader(filename, expected_file, lang.unwrap_or(Lang::English))
|
||||
}
|
||||
|
||||
#[cached(time = 600)]
|
||||
fn reader(filename: FilePath, expected_file: MType) -> Option<File> {
|
||||
let as_str = filename.to_string();
|
||||
Path::new(&as_str)
|
||||
.extension()
|
||||
.and_then(|ext| match ext.to_str().unwrap() {
|
||||
"pdf" => fs::read(&as_str).map_or(None, |bytes| Some(read_pdf(bytes))),
|
||||
_ => fs::read_to_string(&as_str).map_or(None, |text| {
|
||||
fn reader(filename: FilePath, expected_file: MType, lang: Lang) -> Option<File> {
|
||||
let as_str = match lang {
|
||||
Lang::French => {
|
||||
let str = filename.to_string();
|
||||
let mut parts = str.split('.').collect::<Vec<_>>();
|
||||
let extension = parts.pop().unwrap_or("");
|
||||
let filename = parts.join(".");
|
||||
&format!("{filename}-fr.{extension}")
|
||||
}
|
||||
Lang::English => &filename.to_string(),
|
||||
};
|
||||
let path = Path::new(as_str);
|
||||
|
||||
if let Ok(metadata) = path.metadata() {
|
||||
// Taille maximale : 30M
|
||||
if metadata.size() > 30 * 1000 * 1000 {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
path.extension().and_then(|ext| {
|
||||
match mime_guess::from_ext(ext.to_str().unwrap_or_default()).first_or_text_plain() {
|
||||
mime if mime == mime::APPLICATION_PDF => {
|
||||
fs::read(as_str).map_or(None, |bytes| Some(read_pdf(bytes)))
|
||||
}
|
||||
mime if mime.type_() == mime::IMAGE => {
|
||||
fs::read(as_str).map_or(None, |bytes| Some(read_img(bytes, &mime)))
|
||||
}
|
||||
_ => fs::read_to_string(as_str).map_or(None, |text| {
|
||||
Some(read_md(&filename, &text, expected_file, None, true))
|
||||
}),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -80,14 +121,59 @@ fn read_pdf(data: Vec<u8>) -> File {
|
|||
metadata: Metadata::default(),
|
||||
content: format!(
|
||||
r#"<embed
|
||||
src="data:application/pdf;base64,{pdf}"
|
||||
src="data:{};base64,{pdf}"
|
||||
style="width: 100%; height: 79vh";
|
||||
>"#
|
||||
>"#,
|
||||
mime::APPLICATION_PDF
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_img(data: Vec<u8>, mime: &mime::Mime) -> File {
|
||||
let image = general_purpose::STANDARD.encode(data);
|
||||
|
||||
File {
|
||||
metadata: Metadata::default(),
|
||||
content: format!("<img src='data:{mime};base64,{image}'>"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove the first character of a string
|
||||
pub fn remove_first_letter(s: &str) -> &str {
|
||||
s.chars().next().map(|c| &s[c.len_utf8()..]).unwrap()
|
||||
}
|
||||
|
||||
#[derive(Hash, PartialEq, Eq, Clone)]
|
||||
pub enum Lang {
|
||||
French,
|
||||
English,
|
||||
}
|
||||
|
||||
impl Lang {
|
||||
pub fn default() -> String {
|
||||
Lang::French.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Lang {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Lang::French => write!(f, "fr"),
|
||||
Lang::English => write!(f, "en"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the browser language
|
||||
pub fn lang(headers: &HeaderMap) -> Lang {
|
||||
headers
|
||||
.get("Accept-Language")
|
||||
.and_then(|lang| lang.to_str().ok())
|
||||
.and_then(|lang| {
|
||||
["fr", "fr-FR"]
|
||||
.into_iter()
|
||||
.any(|i| lang.contains(i))
|
||||
.then_some(Lang::French)
|
||||
})
|
||||
.unwrap_or(Lang::English)
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ impl Post {
|
|||
path: format!("{}{ext}", self.url),
|
||||
},
|
||||
MType::Blog,
|
||||
None,
|
||||
) {
|
||||
self.content = Some(file.content);
|
||||
}
|
||||
|
@ -149,6 +150,7 @@ pub fn get_post(
|
|||
path: format!("{filename}{ext}"),
|
||||
},
|
||||
MType::Blog,
|
||||
None,
|
||||
);
|
||||
|
||||
let default = (
|
||||
|
|
|
@ -57,7 +57,14 @@ pub fn remove_paragraphs(list: &mut [File]) {
|
|||
pub fn read(path: &FilePath) -> Vec<File> {
|
||||
glob(&path.to_string())
|
||||
.unwrap()
|
||||
.map(|e| read_file(path.from(&e.unwrap().to_string_lossy()), MType::Contact).unwrap())
|
||||
.map(|e| {
|
||||
read_file(
|
||||
path.from(&e.unwrap().to_string_lossy()),
|
||||
MType::Contact,
|
||||
None,
|
||||
)
|
||||
.unwrap()
|
||||
})
|
||||
.filter(|f| {
|
||||
!f.metadata
|
||||
.info
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
</head>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/contact.css" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/contrib.css" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/cours.css" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/index.css" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/portfolio.css" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="index" lang="fr">
|
||||
<html class="index" lang="{{lang}}">
|
||||
<head dir="ltr">
|
||||
<title>{{page_title}}{{#page_title}} - {{/page_title}}{{app_name}}</title>
|
||||
<meta charset="UTF-8" />
|
||||
|
|
Loading…
Reference in a new issue