Compare commits

..

No commits in common. "update-dependencies-clap" and "master" have entirely different histories.

13 changed files with 456 additions and 705 deletions

736
Cargo.lock generated
View File

@ -1,685 +1,341 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.3" version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [ dependencies = [
"memchr", "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "android-tzdata" name = "ansi_term"
version = "0.1.1" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [ dependencies = [
"libc", "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "anstream" name = "atty"
version = "0.6.18" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [ dependencies = [
"anstyle", "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"anstyle-parse", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"anstyle-query", "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
] ]
[[package]]
name = "anstyle"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.8.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]] [[package]]
name = "bumpalo" name = "bitflags"
version = "3.17.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
[[package]]
name = "cc"
version = "1.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda"
dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.28" version = "2.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff"
dependencies = [ dependencies = [
"clap_builder", "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap_derive", "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "clap_builder"
version = "4.5.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]]
name = "colorchoice"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "getopts" name = "getopts"
version = "0.2.17" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
[[package]] [[package]]
name = "hashbrown" name = "lazy_static"
version = "0.15.2" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "iana-time-zone"
version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]]
name = "indexmap"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "is-terminal"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37"
dependencies = [
"hermit-abi",
"libc",
"windows-sys",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.169" version = "0.2.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "log"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [ dependencies = [
"autocfg", "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "once_cell"
version = "1.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
[[package]] [[package]]
name = "pathdiff" name = "pathdiff"
version = "0.2.3" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.91" version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3"
dependencies = [ dependencies = [
"unicode-ident", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "pulldown-cmark" name = "pulldown-cmark"
version = "0.12.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
dependencies = [ dependencies = [
"bitflags", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
"pulldown-cmark-escape",
"unicase",
] ]
[[package]] [[package]]
name = "pulldown-cmark-escape" name = "quote"
version = "0.11.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" dependencies = [
"proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "quote" name = "redox_syscall"
version = "1.0.37" version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_termios"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [ dependencies = [
"proc-macro2", "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.11.1" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr", "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-automata", "regex-syntax 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax", "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
] "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
] ]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.5" version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" dependencies = [
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]] ]
name = "rustversion"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.217" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
dependencies = [
"serde_derive",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.217" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote", "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn", "serde_derive_internals 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "serde_spanned" name = "serde_derive_internals"
version = "0.6.8" version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [ dependencies = [
"serde", "proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
] "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "stderrlog"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c910772f992ab17d32d6760e167d2353f4130ed50e796752689556af07dc6b"
dependencies = [
"chrono",
"is-terminal",
"log",
"termcolor",
"thread_local",
] ]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.11.1" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "structopt"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt-derive 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "structopt-derive"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.89" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote", "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-ident", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "teascade-generator" name = "teascade-generator"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log", "pathdiff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pathdiff", "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark", "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"regex", "serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"serde", "serde_derive 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive", "structopt 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"stderrlog", "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"toml",
] ]
[[package]] [[package]]
name = "termcolor" name = "termion"
version = "1.1.3" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [ dependencies = [
"winapi-util", "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "textwrap"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.8" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [ dependencies = [
"cfg-if", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.20" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
dependencies = [ dependencies = [
"serde", "serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_spanned",
"toml_datetime",
"toml_edit",
] ]
[[package]] [[package]]
name = "toml_datetime" name = "ucd-util"
version = "0.6.8" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-width"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unreachable"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
dependencies = [ dependencies = [
"serde", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "toml_edit" name = "utf8-ranges"
version = "0.22.23" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vec_map"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
dependencies = [ dependencies = [
"indexmap", "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde", "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_spanned",
"toml_datetime",
"winnow",
] ]
[[package]] [[package]]
name = "unicase" name = "winapi-i686-pc-windows-gnu"
version = "2.8.1" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
[[package]] [[package]]
name = "unicode-ident" name = "winapi-x86_64-pc-windows-gnu"
version = "1.0.14" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]] [metadata]
name = "utf8parse" "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
version = "0.2.2" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
source = "registry+https://github.com/rust-lang/crates.io-index" "checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
[[package]] "checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
name = "wasm-bindgen" "checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
version = "0.2.100" "checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
source = "registry+https://github.com/rust-lang/crates.io-index" "checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
dependencies = [ "checksum pathdiff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a3bf70094d203e07844da868b634207e71bfab254fe713171fae9a6e751ccf31"
"cfg-if", "checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"
"once_cell", "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
"rustversion", "checksum quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a"
"wasm-bindgen-macro", "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
] "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb"
[[package]] "checksum regex-syntax 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bd90079345f4a4c3409214734ae220fd773c6f2e8a543d07370c6c1c369cfbfb"
name = "wasm-bindgen-backend" "checksum serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "4c36359ac1a823e00db02a243376ced650f088dc1f6259bbf828e4668e3c7399"
version = "0.2.100" "checksum serde_derive 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "f0477feff739386f5bca8e13fa43d96a4e834904d538f503906c8179f9205f50"
source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_derive_internals 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9d30c4596450fd7bbda79ef15559683f9a79ac0193ea819db90000d7e1cae794"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
dependencies = [ "checksum structopt 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbf9b178b64479997d9515aa4a6956ada20a9829fa03fee3bbcff5962e4e405"
"bumpalo", "checksum structopt-derive 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "29040b33bfc5dae3a321f79cbcd86813a5f024e3040a31f057188e7f2b6228ba"
"log", "checksum syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59"
"proc-macro2", "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"quote", "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
"syn", "checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
"wasm-bindgen-shared", "checksum toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9"
] "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
[[package]] "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
name = "wasm-bindgen-macro" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
version = "0.2.100" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
dependencies = [ "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
"quote", "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"wasm-bindgen-macro-support", "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "winapi-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys",
]
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603"
dependencies = [
"memchr",
]

View File

@ -2,16 +2,13 @@
name = "teascade-generator" name = "teascade-generator"
version = "0.1.0" version = "0.1.0"
authors = ["Teascade <teascade@gmail.com>"] authors = ["Teascade <teascade@gmail.com>"]
edition = "2021"
[dependencies] [dependencies]
pulldown-cmark = "0.12.2" pulldown-cmark = "*"
toml = "0.8.20" toml = "*"
regex = "1.11.1" structopt = "*"
pathdiff = "0.2.3" serde = "*"
clap = { version = "4.5.28", features = ["derive"] } serde_derive = "*"
serde = "1.0.217" regex = "*"
serde_derive = "1.0.217" ansi_term = "*"
stderrlog = "0.6.0" pathdiff = "*"
log = "*"

View File

@ -1,17 +1,18 @@
use std::path::PathBuf;
use std::path::Path;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::Path; use std::error::Error as STDError;
use std::path::PathBuf;
use pathdiff; use pathdiff;
use crate::config::Config; use config::Config;
use crate::error::Error; use template::Template;
use crate::file_writer; use renderer;
use crate::logger::LogLevel; use logger::{LogLevel, Logger};
use crate::options::Options; use error::Error;
use crate::renderer; use options::{BuildOpt, Opt};
use crate::template::Template; use file_writer;
const DEFAULT_CSS: &'static str = include_str!("templates/default-css.css"); const DEFAULT_CSS: &'static str = include_str!("templates/default-css.css");
const DEFAULT_JS: &'static str = include_str!("templates/default-js.js"); const DEFAULT_JS: &'static str = include_str!("templates/default-js.js");
@ -28,8 +29,8 @@ fn fetch_config() -> Result<Config, Error> {
} }
} }
pub fn build(opt: &Options) -> Result<(), Error> { pub fn build(logger: &Logger, opt: &Opt, _: &BuildOpt) -> Result<(), Error> {
log::info!("Starting build"); logger.log(LogLevel::INFO, "Starting build");
let config = fetch_config()?; let config = fetch_config()?;
if config.global_config.website.use_default_css { if config.global_config.website.use_default_css {
@ -42,7 +43,7 @@ pub fn build(opt: &Options) -> Result<(), Error> {
.output .output
.unwrap_or("public".to_owned()), .unwrap_or("public".to_owned()),
); );
log::debug!("Adding {:?}", css_path); logger.log(LogLevel::DETAIL, format!("Adding {:?}", css_path));
file_writer::write_file(&css_path, DEFAULT_CSS, opt.overwrite)?; file_writer::write_file(&css_path, DEFAULT_CSS, opt.overwrite)?;
} }
@ -56,11 +57,11 @@ pub fn build(opt: &Options) -> Result<(), Error> {
.output .output
.unwrap_or("public".to_owned()), .unwrap_or("public".to_owned()),
); );
log::debug!("Adding {:?}", js_path); logger.log(LogLevel::DETAIL, format!("Adding {:?}", js_path));
file_writer::write_file(&js_path, DEFAULT_JS, opt.overwrite)?; file_writer::write_file(&js_path, DEFAULT_JS, opt.overwrite)?;
} }
log::info!("Generating page templates"); logger.log(LogLevel::INFO, "Generating page templates");
let page_template = Template::new(PAGE_TEMPLATE); let page_template = Template::new(PAGE_TEMPLATE);
let css_tag_template = Template::new(CSS_TAG); let css_tag_template = Template::new(CSS_TAG);
let js_tag_template = Template::new(JS_TAG); let js_tag_template = Template::new(JS_TAG);
@ -69,28 +70,31 @@ pub fn build(opt: &Options) -> Result<(), Error> {
if config.global_config.navbar.is_some() { if config.global_config.navbar.is_some() {
let navbar_item_template = Template::new(NAVBAR_ITEM); let navbar_item_template = Template::new(NAVBAR_ITEM);
let navbar_image_item_template = Template::new(NAVBAR_IMAGE_ITEM); let navbar_image_item_template = Template::new(NAVBAR_IMAGE_ITEM);
log::debug!("Rendering Navbar"); logger.log(LogLevel::DETAIL, "Rendering Navbar");
navbar_content = navbar_content =
renderer::render_navbar(&config, navbar_item_template, navbar_image_item_template)?; renderer::render_navbar(&config, navbar_item_template, navbar_image_item_template)?;
} }
log::info!("Rendering"); logger.log(LogLevel::INFO, "Rendering");
let configs = config.get_configs()?; let configs = config.get_configs()?;
let mut renders = Vec::new(); let mut renders = Vec::new();
for config in configs.clone() { for config in configs.clone() {
log::trace!("Setting up to render {}", config.page_config.page.html_path); logger.log(
LogLevel::DETAILER,
format!("Setting up to render {}", config.page_config.page.html_path),
);
// Generate CSS tagstags // Generate CSS tagstags
log::trace!("Generating CSS tags"); logger.log(LogLevel::DETAILER, "Generating CSS tags");
let mut css_string = String::new(); let mut css_string = String::new();
let css_list = config.global_config.website.css.clone(); let mut css_list = config.global_config.website.css.clone();
for item in css_list { for item in css_list {
let data = Template::css_tag_data_from(item, false); let data = Template::css_tag_data_from(item, false);
css_string += &*css_tag_template.render(&data); css_string += &*css_tag_template.render(&data);
} }
if let Some(list) = config.page_config.page.css.clone() { if let Some(mut list) = config.page_config.page.css.clone() {
for item in list { for item in list {
let data = Template::css_tag_data_from(item, true); let data = Template::css_tag_data_from(item, true);
css_string += &*css_tag_template.render(&data); css_string += &*css_tag_template.render(&data);
@ -98,16 +102,16 @@ pub fn build(opt: &Options) -> Result<(), Error> {
} }
// Generate JS tags // Generate JS tags
log::trace!("Generating JS tags"); logger.log(LogLevel::DETAILER, "Generating JS tags");
let mut js_string = String::new(); let mut js_string = String::new();
let js_list = config.global_config.website.javascript.clone(); let mut js_list = config.global_config.website.javascript.clone();
for item in js_list { for item in js_list {
let data = Template::css_tag_data_from(item, false); let data = Template::css_tag_data_from(item, false);
js_string += &*js_tag_template.render(&data); js_string += &*js_tag_template.render(&data);
} }
if let Some(list) = config.page_config.page.javascript.clone() { if let Some(mut list) = config.page_config.page.javascript.clone() {
for item in list { for item in list {
let data = Template::css_tag_data_from(item, true); let data = Template::css_tag_data_from(item, true);
js_string += &*js_tag_template.render(&data); js_string += &*js_tag_template.render(&data);
@ -115,10 +119,11 @@ pub fn build(opt: &Options) -> Result<(), Error> {
} }
// Generate and render Injections // Generate and render Injections
log::trace!("Rendering injections."); logger.log(LogLevel::DETAILER, "Rendering injections.");
let (before_navbar, before_content, after_content) = renderer::render_injections(&config)?; let (before_navbar, before_content, after_content) =
renderer::render_injections(&logger, &config)?;
log::trace!("Rendering"); logger.log(LogLevel::DETAILER, "Rendering");
let markdown = renderer::render_markdown_content(&config)?; let markdown = renderer::render_markdown_content(&config)?;
let markdown = renderer::render_custom_markdown(markdown)?; let markdown = renderer::render_custom_markdown(markdown)?;
@ -135,10 +140,13 @@ pub fn build(opt: &Options) -> Result<(), Error> {
let rendered = page_template.render(&data); let rendered = page_template.render(&data);
renders.push(rendered); renders.push(rendered);
log::debug!("Rendered {}", config.page_config.page.html_path); logger.log(
LogLevel::DETAIL,
format!("Rendered {}", config.page_config.page.html_path),
);
} }
log::info!("Writing"); logger.log(LogLevel::INFO, "Writing");
for (idx, config) in configs.clone().iter().enumerate() { for (idx, config) in configs.clone().iter().enumerate() {
let html_path = config.clone().page_config.page.html_path; let html_path = config.clone().page_config.page.html_path;
let html_path = file_writer::add_to_beginning( let html_path = file_writer::add_to_beginning(
@ -150,7 +158,7 @@ pub fn build(opt: &Options) -> Result<(), Error> {
.output .output
.unwrap_or("public".to_owned()), .unwrap_or("public".to_owned()),
); );
log::debug!("Writing {:?}", html_path); logger.log(LogLevel::DETAIL, format!("Writing {:?}", html_path));
if let Some(render) = renders.get(idx) { if let Some(render) = renders.get(idx) {
file_writer::write_file(&html_path, render.clone(), opt.overwrite)?; file_writer::write_file(&html_path, render.clone(), opt.overwrite)?;
} else { } else {
@ -161,7 +169,7 @@ pub fn build(opt: &Options) -> Result<(), Error> {
} }
} }
log::info!("Copying resources"); logger.log(LogLevel::INFO, "Copying resources");
if let Some(resources) = config.global_config.resources.clone() { if let Some(resources) = config.global_config.resources.clone() {
for resource in resources.values() { for resource in resources.values() {
let path = Path::new(&resource.source); let path = Path::new(&resource.source);
@ -180,16 +188,19 @@ pub fn build(opt: &Options) -> Result<(), Error> {
PathBuf::from(resource.source.clone()), PathBuf::from(resource.source.clone()),
dest, dest,
) { ) {
Ok(_) => log::debug!("Resource successfully copied."), Ok(_) => logger.log(LogLevel::DETAIL, "Resource successfully copied."),
Err(err) => return Err(err), Err(err) => return Err(err),
} }
} else { } else {
log::warn!("Resource does not exist: {:?}", path); logger.log(
LogLevel::WARNING,
format!("Resource does not exist: {:?}", path),
);
} }
} }
} }
log::info!("Done!"); logger.log(LogLevel::INFO, "Done!");
Ok(()) Ok(())
} }
@ -219,7 +230,7 @@ fn write_recursive_resource(
Ok(()) Ok(())
} else { } else {
match File::open(resource_path.clone()) { match File::open(resource_path.clone()) {
Ok(read_file) => { Ok(mut read_file) => {
let bytes: Vec<u8> = match read_file.bytes().collect() { let bytes: Vec<u8> = match read_file.bytes().collect() {
Ok(bytes) => bytes, Ok(bytes) => bytes,
Err(_) => Vec::new(), Err(_) => Vec::new(),
@ -237,7 +248,11 @@ fn write_recursive_resource(
} }
Err(err) => Err(Error::new( Err(err) => Err(Error::new(
LogLevel::SEVERE, LogLevel::SEVERE,
format!("Failed to open read file {:?}: {}", resource_path, err), format!(
"Failed to open read file {:?}: {}",
resource_path,
err.description().to_owned()
),
)), )),
} }
} }

View File

@ -1,7 +1,7 @@
use crate::config_toml::{GlobalConfigToml, PageConfigToml}; use config_toml::{GlobalConfigToml, PageConfigToml};
use std::path::PathBuf; use std::path::PathBuf;
use crate::error::Error; use error::Error;
use crate::logger::LogLevel; use logger::LogLevel;
#[derive(Clone)] #[derive(Clone)]
pub struct SinglePageConfigs { pub struct SinglePageConfigs {

View File

@ -1,10 +1,8 @@
use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
use std::collections::HashMap;
use serde_derive::{Deserialize, Serialize}; use error::Error;
use file_writer;
use crate::error::Error;
use crate::file_writer;
#[derive(Deserialize, Serialize, Clone, Debug)] #[derive(Deserialize, Serialize, Clone, Debug)]
pub struct GlobalConfigToml { pub struct GlobalConfigToml {

View File

@ -1,7 +1,8 @@
use std::convert::From; use std::convert::From;
use std::io::Error as IOError; use std::io::Error as IOError;
use std::error::Error as STDError;
use crate::logger::LogLevel; use logger::LogLevel;
#[derive(Debug)] #[derive(Debug)]
pub struct Error { pub struct Error {
@ -33,7 +34,7 @@ impl From<IOError> for Error {
os_error = format!("OS Error: {}", error); os_error = format!("OS Error: {}", error);
} }
Error { Error {
description: format!("IOError: {} {}", err, os_error), description: format!("IOError: {} {}", err.description().to_owned(), os_error),
severity: LogLevel::SEVERE, severity: LogLevel::SEVERE,
} }
} }

View File

@ -1,13 +1,14 @@
use std::fs::{create_dir_all, File}; use std::fs::{create_dir_all, File};
use std::io::prelude::*; use std::io::prelude::*;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::error::Error as STDError;
use serde::de::DeserializeOwned;
use serde::Serialize; use serde::Serialize;
use serde::de::DeserializeOwned;
use toml; use toml;
use crate::error::Error; use error::Error;
use crate::logger::LogLevel; use logger::LogLevel;
pub fn add_to_beginning<T: Into<String>>(path: PathBuf, to_add: T) -> PathBuf { pub fn add_to_beginning<T: Into<String>>(path: PathBuf, to_add: T) -> PathBuf {
Path::new(&to_add.into()).join(path) Path::new(&to_add.into()).join(path)
@ -26,7 +27,7 @@ pub fn get_toml<T: DeserializeOwned>(path: &PathBuf) -> Result<T, Error> {
format!( format!(
"Failed to open toml: {}, Reason: {}", "Failed to open toml: {}, Reason: {}",
path.to_str().unwrap(), path.to_str().unwrap(),
err err.description().to_owned()
), ),
)) ))
} }
@ -35,10 +36,22 @@ pub fn get_toml<T: DeserializeOwned>(path: &PathBuf) -> Result<T, Error> {
file.read_to_string(&mut contents)?; file.read_to_string(&mut contents)?;
match toml::from_str(&contents) { match toml::from_str(&contents) {
Ok(config) => Ok(config), Ok(config) => Ok(config),
Err(err) => Err(Error::new( Err(err) => {
LogLevel::SEVERE, if let Some((line, col)) = err.line_col() {
format!("Erronous toml ({}): {}", path_str, err), Err(Error::new(
)), LogLevel::SEVERE,
format!("Erronous toml: {} at {}:{}", path_str, line, col),
))
} else {
Err(Error::new(
LogLevel::SEVERE,
format!(
"Failed to parse toml correctly: {}. Check variable names!",
path_str
),
))
}
}
} }
} }
@ -57,7 +70,11 @@ pub fn write_toml<T: Serialize>(path: &PathBuf, data: &T, overwrite: bool) -> Re
}, },
Err(err) => Err(Error::new( Err(err) => Err(Error::new(
LogLevel::SEVERE, LogLevel::SEVERE,
format!("Failed to serialize {:?}: {}", path, err), format!(
"Failed to serialize {:?}: {}",
path,
err.description().to_owned()
),
)), )),
} }
} }
@ -72,7 +89,7 @@ pub fn write_file<T: Into<String>>(
pub fn write_bytes(path: &PathBuf, bytes: &[u8], overwrite: bool) -> Result<(), Error> { pub fn write_bytes(path: &PathBuf, bytes: &[u8], overwrite: bool) -> Result<(), Error> {
if let Some(parent) = path.clone().parent() { if let Some(parent) = path.clone().parent() {
create_dir_all(parent)?; create_dir_all(parent.clone())?;
} else { } else {
return Err(Error::new( return Err(Error::new(
LogLevel::SEVERE, LogLevel::SEVERE,

View File

@ -1,3 +1,28 @@
use ansi_term::Color::{Blue, Cyan, Red, Yellow};
pub struct Logger {
log_level: LogLevel,
}
impl Logger {
pub fn new(log_level: LogLevel) -> Logger {
Logger { log_level }
}
pub fn log<T: Into<String>>(&self, log_level: LogLevel, message: T) {
if self.log_level.clone() as i32 >= log_level.clone() as i32 {
match log_level {
LogLevel::QUIET => (),
LogLevel::SEVERE => eprintln!("{}: {}", Red.paint("[SEVERE]"), message.into()),
LogLevel::INFO => println!("{}: {}", Cyan.paint("[INFO]"), message.into()),
LogLevel::WARNING => println!("{}: {}", Yellow.paint("[WARNING]"), message.into()),
LogLevel::DETAIL => println!("{}: {}", Blue.paint("[DETAIL]"), message.into()),
LogLevel::DETAILER => println!("{}: {}", Blue.paint("[DETAILER]"), message.into()),
}
}
}
}
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[repr(u8)] #[repr(u8)]

View File

@ -1,22 +1,34 @@
mod builder; extern crate ansi_term;
mod config; extern crate pathdiff;
mod config_toml; extern crate pulldown_cmark;
mod error; extern crate regex;
mod file_writer; extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate structopt;
extern crate toml;
mod logger; mod logger;
mod new_page;
mod options; mod options;
mod renderer; mod error;
mod config_toml;
mod config;
mod template; mod template;
mod renderer;
mod builder;
mod new_page;
mod file_writer;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
use clap::Parser; use structopt::StructOpt;
use crate::config_toml::{GlobalConfigToml, NavbarConfig, NavbarItem, WebsiteConfig}; use logger::{LogLevel, Logger};
use crate::options::{Options, Subcommands}; use options::{Opt, Subcommands};
use config_toml::{GlobalConfigToml, NavbarConfig, NavbarItem, WebsiteConfig};
//TODO: Custom markdown //TODO: Custom markdown
fn main() { fn main() {
@ -27,42 +39,39 @@ fn main() {
} }
fn run() -> Result<(), ()> { fn run() -> Result<(), ()> {
let opt: Options = Options::parse(); let opt = Opt::from_args();
let log_level = (3 - opt.quiet as i8 + opt.verbose as i8).max(0).min(5); let log_level = (3 - opt.quiet as i8 + opt.verbose as i8).max(0).min(5);
let logger = Logger::new(LogLevel::from(log_level as u8));
stderrlog::new()
.module(module_path!())
.verbosity(log_level as usize)
.timestamp(stderrlog::Timestamp::Second)
.init()
.unwrap();
match opt.clone().cmd { match opt.clone().cmd {
Subcommands::Build => match builder::build(&opt) { Subcommands::Build(build_opt) => match builder::build(&logger, &opt, &build_opt) {
Ok(_) => { Ok(_) => {
log::trace!("Building finished successfully."); logger.log(LogLevel::DETAILER, "Building finished successfully.");
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
log::error!("{}", err.description()); logger.log(err.severity(), err.description());
log::error!("Aborting building due to error."); logger.log(LogLevel::SEVERE, "Aborting building due to error.");
Err(()) Err(())
} }
}, },
Subcommands::New(new_opt) => match new_page::generate_new_page(&opt, &new_opt) { Subcommands::New(new_opt) => match new_page::generate_new_page(&logger, &opt, &new_opt) {
Ok(_) => { Ok(_) => {
log::trace!("Generating the new page finished successfully."); logger.log(
LogLevel::DETAILER,
"Generating the new page finished successfully.",
);
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
log::error!("{}", err.description()); logger.log(err.severity(), err.description());
log::error!("Aborting building due to error."); logger.log(LogLevel::SEVERE, "Aborting building due to error.");
Err(()) Err(())
} }
}, },
Subcommands::Initialize(init_opt) => { Subcommands::Initialize(init_opt) => {
log::debug!("Generating config.toml"); logger.log(LogLevel::DETAIL, "Generating config.toml");
let mut navbar = None; let mut navbar = None;
if !init_opt.no_default_navbar { if !init_opt.no_default_navbar {
@ -117,11 +126,14 @@ fn run() -> Result<(), ()> {
match file_writer::write_toml(&PathBuf::from("config.toml"), &config, opt.overwrite) { match file_writer::write_toml(&PathBuf::from("config.toml"), &config, opt.overwrite) {
Ok(_) => { Ok(_) => {
log::info!("Done!"); logger.log(LogLevel::INFO, "Done!");
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
log::error!("Initialization failed: {}", err.description()); logger.log(
err.severity(),
format!("Initialization failed: {}", err.description()),
);
Err(()) Err(())
} }
} }

View File

@ -1,14 +1,15 @@
use std::path::PathBuf; use std::path::PathBuf;
use crate::config_toml::{GlobalConfigToml, PageConfig, PageConfigToml}; use options::{NewOpt, Opt};
use crate::error::Error; use logger::{LogLevel, Logger};
use crate::file_writer; use file_writer;
use crate::logger::LogLevel; use error::Error;
use crate::options::{NewOpt, Options}; use config_toml::{GlobalConfigToml, PageConfig, PageConfigToml};
use pathdiff; use pathdiff;
const PLACEHOLDER_MARKDOWN: &'static str = r#"# Placeholder title const PLACEHOLDER_MARKDOWN: &'static str =
r#"# Placeholder title
This is the markdown file, where you will insert this page's contents. This is the markdown file, where you will insert this page's contents.
- This is an example list - This is an example list
- And in lists - And in lists
@ -16,8 +17,11 @@ This is the markdown file, where you will insert this page's contents.
See [CommonMark](http://commonmark.org/help/) for reference."#; See [CommonMark](http://commonmark.org/help/) for reference."#;
pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> { pub fn generate_new_page(logger: &Logger, opt: &Opt, new_opt: &NewOpt) -> Result<(), Error> {
log::trace!("Starting to create paths for given files"); logger.log(
LogLevel::DETAILER,
format!("Starting to create paths for given files"),
);
let toml_path = ensure_extension(new_opt.toml_path.clone(), "toml", false)?; let toml_path = ensure_extension(new_opt.toml_path.clone(), "toml", false)?;
@ -28,13 +32,18 @@ pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> {
markdown_path = ensure_extension(toml_path.clone(), "md", true)?; markdown_path = ensure_extension(toml_path.clone(), "md", true)?;
} }
log::info!( logger.log(
"Creating page config at {:?} and markdown at {:?}", LogLevel::INFO,
toml_path, format!(
markdown_path "Creating page config at {:?} and markdown at {:?}",
toml_path, markdown_path
),
); );
log::debug!("Creating a new .toml file at {:?}", toml_path); logger.log(
LogLevel::DETAIL,
format!("Creating a new .toml file at {:?}", toml_path),
);
let html_path; let html_path;
if let Some(path) = new_opt.html_path.clone() { if let Some(path) = new_opt.html_path.clone() {
@ -58,7 +67,10 @@ pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> {
} }
} }
log::trace!("Generating page config.toml contents"); logger.log(
LogLevel::DETAILER,
format!("Generating page config.toml contents"),
);
let page_config = PageConfigToml { let page_config = PageConfigToml {
page: PageConfig { page: PageConfig {
@ -76,7 +88,10 @@ pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> {
}; };
match file_writer::write_toml(&toml_path, &page_config, opt.overwrite) { match file_writer::write_toml(&toml_path, &page_config, opt.overwrite) {
Ok(_) => log::info!("{:?} created successfully", toml_path), Ok(_) => logger.log(
LogLevel::INFO,
format!("{:?} created successfully", toml_path),
),
Err(err) => { Err(err) => {
return Err(Error::new( return Err(Error::new(
err.severity(), err.severity(),
@ -85,7 +100,10 @@ pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> {
} }
} }
log::debug!("Creating a new .md file at {:?}", markdown_path); logger.log(
LogLevel::DETAIL,
format!("Creating a new .md file at {:?}", markdown_path),
);
file_writer::write_file(&markdown_path, PLACEHOLDER_MARKDOWN, opt.overwrite)?; file_writer::write_file(&markdown_path, PLACEHOLDER_MARKDOWN, opt.overwrite)?;
@ -94,14 +112,20 @@ pub fn generate_new_page(opt: &Options, new_opt: &NewOpt) -> Result<(), Error> {
return Err(Error::new(LogLevel::SEVERE, "Add --overwrite flag to overwrite config.toml, or --no-modify-config to not modify config.toml automatically.")); return Err(Error::new(LogLevel::SEVERE, "Add --overwrite flag to overwrite config.toml, or --no-modify-config to not modify config.toml automatically."));
} }
log::info!("Adding page config path to config.toml"); logger.log(
LogLevel::INFO,
format!("Adding page config path to config.toml"),
);
let mut config = GlobalConfigToml::get_config()?; let mut config = GlobalConfigToml::get_config()?;
config config
.website .website
.built_pages .built_pages
.push(toml_path.to_str().unwrap().to_owned()); .push(toml_path.to_str().unwrap().to_owned());
log::debug!("Re-serializing config and writing it"); logger.log(
LogLevel::DETAIL,
format!("Re-serializing config and writing it"),
);
match file_writer::write_toml(&PathBuf::from("config.toml"), &config, opt.overwrite) { match file_writer::write_toml(&PathBuf::from("config.toml"), &config, opt.overwrite) {
Ok(_) => {} Ok(_) => {}
@ -127,7 +151,7 @@ fn ensure_extension<T: Into<String>>(
if let (Some(parent), Some(file_name)) = (path.clone().parent(), path.clone().file_name()) { if let (Some(parent), Some(file_name)) = (path.clone().parent(), path.clone().file_name()) {
let mut filename = file_name.to_str().unwrap().to_owned(); let mut filename = file_name.to_str().unwrap().to_owned();
let clone = filename.clone(); let clone = filename.clone();
let split = clone.split("."); let mut split = clone.split(".");
if split.clone().count() == 1 as usize { if split.clone().count() == 1 as usize {
path = parent.join(format!("{}.{}", filename, extension)); path = parent.join(format!("{}.{}", filename, extension));
} else if replace_extension { } else if replace_extension {

View File

@ -1,78 +1,79 @@
use std::path::PathBuf; use std::path::PathBuf;
use clap::{Parser, Subcommand}; #[derive(StructOpt, Debug, Clone)]
#[structopt(name = "Teasca.de Generator",
/// A website generator, used mainly for generating teascade.net about = "A website generator, used mainly for generating teasca.de")]
#[derive(Parser, Debug, Clone)] pub struct Opt {
#[command(version, about, long_about = None)] /// Verbose flag, makes the program more noisy. (-vv for maximum noisiness)
pub struct Options { #[structopt(short = "v", long = "verbose", parse(from_occurrences))]
/// verbose flag, makes the program more noisy. (-vv for maximum noisiness)
#[arg(short, long, action = clap::ArgAction::Count)]
pub verbose: u8, pub verbose: u8,
/// quiet flag, makes the program less noisy. (-qqq for minimum noisiness) /// Quiet flag, makes the program less noisy. (-qqq for minimum noisiness)
#[arg(short, long, action = clap::ArgAction::Count)] #[structopt(short = "q", long = "quiet", parse(from_occurrences))]
pub quiet: u8, pub quiet: u8,
/// overwrites necessary files to create new ones. /// Overwrites necessary files to create new ones.
#[arg(short, long)] #[structopt(short = "o", long = "overwrite")]
pub overwrite: bool, pub overwrite: bool,
#[command(subcommand)] #[structopt(subcommand)]
pub cmd: Subcommands, pub cmd: Subcommands,
} }
#[derive(Subcommand, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
pub enum Subcommands { pub enum Subcommands {
/// Build the website /// Build the website
Build, #[structopt(name = "build")]
Build(BuildOpt),
/// Create a new page /// Create a new page
#[structopt(name = "new")]
New(NewOpt), New(NewOpt),
/// Initializes a config.toml /// Initializes a config.toml
#[command(name = "init")] #[structopt(name = "init")]
Initialize(InitializeOpt), Initialize(InitializeOpt),
} }
#[derive(Parser, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
#[clap(disable_help_flag = true)] pub struct BuildOpt {}
pub struct NewOpt {
#[clap(long, action = clap::ArgAction::HelpLong)]
help: Option<bool>,
/// file path for the .toml file created #[derive(StructOpt, Debug, Clone)]
pub struct NewOpt {
/// File path for the .toml file created
#[structopt(parse(from_os_str))]
pub toml_path: PathBuf, pub toml_path: PathBuf,
/// file path for the markdown file created /// File path for the markdown file created
#[arg(long = "markdown", short)] #[structopt(short = "m", long = "markdown", parse(from_os_str))]
pub markdown_path: Option<PathBuf>, pub markdown_path: Option<PathBuf>,
/// output html file path of the generated page /// Outpuh html file path of the generated page
#[arg(long = "html", short)] #[structopt(short = "h", long = "html", parse(from_os_str))]
pub html_path: Option<PathBuf>, pub html_path: Option<PathBuf>,
/// sets the title of the generated page /// Sets the title of the generated page
#[arg(short, long)] #[structopt(short = "t", long = "title")]
pub title: Option<String>, pub title: Option<String>,
/// don't modify config.toml automatically /// Don't modify config.toml automatically
#[arg(short, long)] #[structopt(short = "n", long = "no-modify-config")]
pub no_modify_config: bool, pub no_modify_config: bool,
} }
#[derive(Parser, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
pub struct InitializeOpt { pub struct InitializeOpt {
/// name of the webpage /// Name of the webpage
#[structopt()]
pub name: String, pub name: String,
/// favicon /// Favicon
#[arg(short, long)] #[structopt(short = "f", long = "favicon")]
pub favicon: Option<String>, pub favicon: Option<String>,
/// twitter author /// Twitter author
#[arg(long = "twitter", short)] #[structopt(short = "t", long = "twitter")]
pub twitter_author: Option<String>, pub twitter_author: Option<String>,
/// disables the default navbar /// Disables the default navbar
#[arg(short, long = "no-navbar")] #[structopt(short = "n", long = "no-navbar")]
pub no_default_navbar: bool, pub no_default_navbar: bool,
} }

View File

@ -1,15 +1,16 @@
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::error::Error as STDError;
use pulldown_cmark::{html, Parser}; use pulldown_cmark::{html, Parser};
use regex::{Captures, Regex}; use regex::{Captures, Regex};
use crate::config::{Config, SinglePageConfigs}; use config::{Config, SinglePageConfigs};
use crate::config_toml::InjectionToml; use template::Template;
use crate::error::Error; use error::Error;
use crate::logger::LogLevel; use logger::{LogLevel, Logger};
use crate::template::Template; use config_toml::InjectionToml;
fn get_file_contents(path: Option<String>) -> Result<String, Error> { fn get_file_contents(path: Option<String>) -> Result<String, Error> {
match path { match path {
@ -21,14 +22,17 @@ fn get_file_contents(path: Option<String>) -> Result<String, Error> {
} }
Err(err) => Err(Error::new( Err(err) => Err(Error::new(
LogLevel::WARNING, LogLevel::WARNING,
format!("Failed to open {}, {}", url, err), format!("Failed to open {}, {}", url, err.description().to_owned()),
)), )),
}, },
None => Ok(String::new()), None => Ok(String::new()),
} }
} }
pub fn render_injections(config: &SinglePageConfigs) -> Result<(String, String, String), Error> { pub fn render_injections(
logger: &Logger,
config: &SinglePageConfigs,
) -> Result<(String, String, String), Error> {
let before_navbar_url = match config.page_config.page.before_navbar_url.clone() { let before_navbar_url = match config.page_config.page.before_navbar_url.clone() {
Some(url) => Some(url), Some(url) => Some(url),
None => config.global_config.website.before_navbar_url.clone(), None => config.global_config.website.before_navbar_url.clone(),
@ -45,21 +49,21 @@ pub fn render_injections(config: &SinglePageConfigs) -> Result<(String, String,
let before_navbar = match get_file_contents(before_navbar_url) { let before_navbar = match get_file_contents(before_navbar_url) {
Ok(content) => content, Ok(content) => content,
Err(error) => { Err(error) => {
log::error!("{}", error.description()); logger.log(error.severity(), error.description());
String::new() String::new()
} }
}; };
let before_content = match get_file_contents(before_content_url) { let before_content = match get_file_contents(before_content_url) {
Ok(content) => content, Ok(content) => content,
Err(error) => { Err(error) => {
log::error!("{}", error.description()); logger.log(error.severity(), error.description());
String::new() String::new()
} }
}; };
let after_content = match get_file_contents(after_content_url) { let after_content = match get_file_contents(after_content_url) {
Ok(content) => content, Ok(content) => content,
Err(error) => { Err(error) => {
log::error!("{}", error.description()); logger.log(error.severity(), error.description());
String::new() String::new()
} }
}; };
@ -189,7 +193,8 @@ fn replace(config: InjectionToml) -> String {
} }
Err(err) => format!( Err(err) => format!(
"Failed to get template for custom markdown: {}, {}", "Failed to get template for custom markdown: {}, {}",
config.meta.template, err, config.meta.template,
err.description().to_owned(),
), ),
} }
} }

View File

@ -2,8 +2,8 @@ use regex::{Captures, Regex};
use std::collections::HashMap; use std::collections::HashMap;
use crate::config::SinglePageConfigs; use config::SinglePageConfigs;
use crate::config_toml::NavbarItem; use config_toml::NavbarItem;
type Data = HashMap<String, String>; type Data = HashMap<String, String>;