Compare commits

...

7 Commits

13 changed files with 715 additions and 466 deletions

754
Cargo.lock generated
View File

@ -1,341 +1,685 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "0.6.4"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
]
[[package]]
name = "ansi_term"
version = "0.11.0"
name = "android-tzdata"
version = "0.1.1"
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 = [
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc",
]
[[package]]
name = "atty"
version = "0.2.8"
name = "anstream"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"anstyle",
"anstyle-parse",
"anstyle-query",
"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]]
name = "bitflags"
version = "0.9.1"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]]
name = "bitflags"
version = "1.0.1"
name = "bumpalo"
version = "3.17.0"
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]]
name = "clap"
version = "2.31.2"
version = "4.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"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)",
"clap_builder",
"clap_derive",
]
[[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]]
name = "getopts"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
[[package]]
name = "lazy_static"
version = "1.0.0"
name = "hashbrown"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "libc"
version = "0.2.40"
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "memchr"
version = "2.0.1"
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 = [
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "pathdiff"
version = "0.1.0"
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]]
name = "libc"
version = "0.2.169"
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]]
name = "memchr"
version = "2.7.4"
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 = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
[[package]]
name = "pathdiff"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "proc-macro2"
version = "0.3.6"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-ident",
]
[[package]]
name = "pulldown-cmark"
version = "0.1.2"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags",
"getopts",
"memchr",
"pulldown-cmark-escape",
"unicase",
]
[[package]]
name = "pulldown-cmark-escape"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"
[[package]]
name = "quote"
version = "0.5.1"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
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"
dependencies = [
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
]
[[package]]
name = "regex"
version = "0.2.10"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"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)",
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[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]]
name = "regex-syntax"
version = "0.5.5"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rustversion"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
[[package]]
name = "serde"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_derive"
version = "1.0.38"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
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)",
"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)",
"serde_derive",
]
[[package]]
name = "serde_derive_internals"
version = "0.23.1"
name = "serde_derive"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"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)",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_spanned"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [
"serde",
]
[[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]]
name = "strsim"
version = "0.7.0"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[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)",
]
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "0.13.1"
version = "2.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
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)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "teascade-generator"
version = "0.1.0"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pathdiff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"clap",
"log",
"pathdiff",
"pulldown-cmark",
"regex",
"serde",
"serde_derive",
"stderrlog",
"toml",
]
[[package]]
name = "termion"
version = "1.5.1"
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"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)",
"winapi-util",
]
[[package]]
name = "thread_local"
version = "0.3.5"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if",
"once_cell",
]
[[package]]
name = "toml"
version = "0.4.6"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
dependencies = [
"serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "ucd-util"
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"
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
dependencies = [
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde",
]
[[package]]
name = "utf8-ranges"
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"
name = "toml_edit"
version = "0.22.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
name = "unicase"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
name = "unicode-ident"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[metadata]
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4"
"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"
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum pathdiff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a3bf70094d203e07844da868b634207e71bfab254fe713171fae9a6e751ccf31"
"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"
"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
"checksum quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a"
"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"
"checksum regex-syntax 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bd90079345f4a4c3409214734ae220fd773c6f2e8a543d07370c6c1c369cfbfb"
"checksum serde 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "4c36359ac1a823e00db02a243376ced650f088dc1f6259bbf828e4668e3c7399"
"checksum serde_derive 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "f0477feff739386f5bca8e13fa43d96a4e834904d538f503906c8179f9205f50"
"checksum serde_derive_internals 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9d30c4596450fd7bbda79ef15559683f9a79ac0193ea819db90000d7e1cae794"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum structopt 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbf9b178b64479997d9515aa4a6956ada20a9829fa03fee3bbcff5962e4e405"
"checksum structopt-derive 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "29040b33bfc5dae3a321f79cbcd86813a5f024e3040a31f057188e7f2b6228ba"
"checksum syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
"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"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[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,13 +2,16 @@
name = "teascade-generator"
version = "0.1.0"
authors = ["Teascade <teascade@gmail.com>"]
edition = "2021"
[dependencies]
pulldown-cmark = "*"
toml = "*"
structopt = "*"
serde = "*"
serde_derive = "*"
regex = "*"
ansi_term = "*"
pathdiff = "*"
pulldown-cmark = "0.12.2"
toml = "0.8.20"
regex = "1.11.1"
pathdiff = "0.2.3"
clap = { version = "4.5.28", features = ["derive"] }
serde = "1.0.217"
serde_derive = "1.0.217"
stderrlog = "0.6.0"
log = "*"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,28 +1,3 @@
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)]
#[derive(Clone, Debug)]
#[repr(u8)]

View File

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

View File

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

View File

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

View File

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

View File

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