From 715e19cb14c87cf3f307306e97125b4912afef9e Mon Sep 17 00:00:00 2001 From: Montana Low Date: Mon, 4 Dec 2023 17:38:54 -0800 Subject: [PATCH] handle nav sections, badly --- pgml-dashboard/Cargo.lock | 117 +++++++++++++++++++++++++++++++++- pgml-dashboard/Cargo.toml | 2 +- pgml-dashboard/src/api/cms.rs | 6 +- 3 files changed, 121 insertions(+), 4 deletions(-) diff --git a/pgml-dashboard/Cargo.lock b/pgml-dashboard/Cargo.lock index c95938436..f28f4db10 100644 --- a/pgml-dashboard/Cargo.lock +++ b/pgml-dashboard/Cargo.lock @@ -494,6 +494,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "combine" version = "4.6.6" @@ -700,6 +711,31 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossterm" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" +dependencies = [ + "bitflags 1.3.2", + "crossterm_winapi", + "libc", + "mio", + "parking_lot 0.12.1", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -773,6 +809,16 @@ dependencies = [ "cipher", ] +[[package]] +name = "ctrlc" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e95fbd621905b854affdc67943b043a0fbb6ed7385fd5a25650d19a8a6cfdf" +dependencies = [ + "nix", + "windows-sys 0.48.0", +] + [[package]] name = "darling" version = "0.14.4" @@ -942,6 +988,12 @@ dependencies = [ "dtoa", ] +[[package]] +name = "dyn-clone" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" + [[package]] name = "ego-tree" version = "0.6.2" @@ -1676,6 +1728,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "inquire" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33e7c1ddeb15c9abcbfef6029d8e29f69b52b6d6c891031b88ed91b5065803b" +dependencies = [ + "bitflags 1.3.2", + "crossterm", + "dyn-clone", + "lazy_static", + "newline-converter", + "thiserror", + "unicode-segmentation", + "unicode-width", +] + [[package]] name = "instant" version = "0.1.12" @@ -1994,6 +2062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", + "log", "wasi", "windows-sys 0.48.0", ] @@ -2092,6 +2161,26 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "newline-converter" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f71d09d5c87634207f894c6b31b6a2b2c64ea3bdcf71bd5599fdbbe1600c00f" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.3.3", + "cfg-if", + "libc", +] + [[package]] name = "nom" version = "7.1.3" @@ -2375,13 +2464,18 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pgml" -version = "0.9.6" +version = "0.10.0" dependencies = [ "anyhow", "async-trait", "chrono", + "clap", + "colored", + "ctrlc", "futures", "indicatif", + "inquire", + "is-terminal", "itertools", "lopdf", "md5", @@ -3579,6 +3673,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" diff --git a/pgml-dashboard/Cargo.toml b/pgml-dashboard/Cargo.toml index 9437c6128..3ffe6c194 100644 --- a/pgml-dashboard/Cargo.toml +++ b/pgml-dashboard/Cargo.toml @@ -29,7 +29,7 @@ log = "0.4" markdown = "1.0.0-alpha.14" num-traits = "0.2" once_cell = "1.18" -pgml = { version = "0.9.6", path = "../pgml-sdks/pgml/" } +pgml = { version = "0.10.0", path = "../pgml-sdks/pgml/" } pgml-components = { path = "../packages/pgml-components" } pgvector = { version = "0.2.2", features = [ "sqlx", "postgres" ] } rand = "0.8" diff --git a/pgml-dashboard/src/api/cms.rs b/pgml-dashboard/src/api/cms.rs index 0c703b661..5117c0a3e 100644 --- a/pgml-dashboard/src/api/cms.rs +++ b/pgml-dashboard/src/api/cms.rs @@ -92,6 +92,7 @@ impl Collection { let mdast = markdown::to_mdast(&summary_contents, &::markdown::ParseOptions::default()) .unwrap_or_else(|_| panic!("Could not parse summary: {summary_path:?}")); + let mut index = Vec::new(); for node in mdast .children() .unwrap_or_else(|| panic!("Summary has no content: {summary_path:?}")) @@ -99,16 +100,17 @@ impl Collection { { match node { Node::List(list) => { - self.index = self.get_sub_links(list).unwrap_or_else(|_| { + let mut links = self.get_sub_links(list).unwrap_or_else(|_| { panic!("Could not parse list of index links: {summary_path:?}") }); - break; + index.append(&mut links); } _ => { warn!("Irrelevant content ignored in: {summary_path:?}") } } } + self.index = index; if self.index.is_empty() { error!("Index has no entries for Collection: {}", self.name); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy