diff --git a/docs/book/post_build.py b/docs/book/post_build.py index fc9fc3a..20691a8 100644 --- a/docs/book/post_build.py +++ b/docs/book/post_build.py @@ -13,8 +13,8 @@ def main(): if os.path.isdir(category_dir): for file in os.listdir(category_dir): if file.endswith(".md") and (len(sys.argv) == 1 or (sys.argv[1] in file)): - build_and_copy_demo(category, file) - rewrite_links(category, file) + if build_and_copy_demo(category, file): + rewrite_links(category, file) def build_and_copy_demo(category, md_name): @@ -51,7 +51,7 @@ def build_and_copy_demo(category, md_name): with open(book_html_path, "w") as f: f.write( - f"""{head_split[0]} + f"""{head_split[0]} {demo_head} {target_head} @@ -62,6 +62,10 @@ def build_and_copy_demo(category, md_name): {body_split[1]}""") + return True + + return False + def rewrite_links(category, md_name): """Rewrite links in generated documentation to make them diff --git a/examples/use_broadcast_channel/Cargo.toml b/examples/use_broadcast_channel/Cargo.toml index 6a95089..a7bf756 100644 --- a/examples/use_broadcast_channel/Cargo.toml +++ b/examples/use_broadcast_channel/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] leptos = { version = "0.6", features = ["nightly", "csr"] } +codee = "0.1" console_error_panic_hook = "0.1" console_log = "1" log = "0.4" diff --git a/examples/use_broadcast_channel/src/main.rs b/examples/use_broadcast_channel/src/main.rs index 749ae88..3890bdc 100644 --- a/examples/use_broadcast_channel/src/main.rs +++ b/examples/use_broadcast_channel/src/main.rs @@ -1,6 +1,6 @@ +use codee::string::FromToStringCodec; use leptos::*; use leptos_use::docs::demo_or_body; -use leptos_use::utils::FromToStringCodec; use leptos_use::{use_broadcast_channel, UseBroadcastChannelReturn}; #[component] @@ -46,8 +46,8 @@ fn Demo() -> impl IntoView {

"Received message: " {move || message().as_ref().unwrap().to_string()}

- -

"Error: " {move || format!("{:?}", error().as_ref().unwrap())}

+ +

"Error: " {move || error.with(|e| format!("{:?}", e.as_ref().unwrap()))}

} diff --git a/examples/use_cookie/Cargo.toml b/examples/use_cookie/Cargo.toml index 280824f..c645550 100644 --- a/examples/use_cookie/Cargo.toml +++ b/examples/use_cookie/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] leptos = { version = "0.6", features = ["nightly", "csr"] } +codee = "0.1" console_error_panic_hook = "0.1" console_log = "1" log = "0.4" diff --git a/examples/use_cookie/src/main.rs b/examples/use_cookie/src/main.rs index 0429b28..4954248 100644 --- a/examples/use_cookie/src/main.rs +++ b/examples/use_cookie/src/main.rs @@ -1,7 +1,7 @@ use leptos::*; use leptos_use::docs::demo_or_body; use leptos_use::use_cookie; -use leptos_use::utils::FromToStringCodec; +use codee::string::FromToStringCodec; use rand::prelude::*; #[component] diff --git a/examples/use_storage/Cargo.toml b/examples/use_storage/Cargo.toml index 4a53065..5174789 100644 --- a/examples/use_storage/Cargo.toml +++ b/examples/use_storage/Cargo.toml @@ -4,14 +4,14 @@ version = "0.1.0" edition = "2021" [dependencies] -codee = { path = "../../../codee", features = ["json_serde"] } -leptos = { version = "0.6", features = ["nightly", "csr"] } +codee = { version = "0.1", features = ["json_serde"] } console_error_panic_hook = "0.1" console_log = "1" -log = "0.4" +leptos = { version = "0.6", features = ["nightly", "csr"] } leptos-use = { path = "../..", features = ["docs"] } -web-sys = "0.3" +log = "0.4" serde = "1.0.163" +web-sys = "0.3" [dev-dependencies] wasm-bindgen = "0.2" diff --git a/examples/use_storage/src/main.rs b/examples/use_storage/src/main.rs index 0d38d7b..524facd 100644 --- a/examples/use_storage/src/main.rs +++ b/examples/use_storage/src/main.rs @@ -1,7 +1,7 @@ use leptos::*; use leptos_use::docs::{demo_or_body, Note}; use leptos_use::storage::use_local_storage; -use leptos_use::utils::JsonCodec; +use codee::string::JsonSerdeCodec; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] @@ -25,8 +25,8 @@ impl Default for BananaState { #[component] fn Demo() -> impl IntoView { - let (state, set_state, reset) = use_local_storage::("banana-state"); - let (state2, _, _) = use_local_storage::("banana-state"); + let (state, set_state, reset) = use_local_storage::("banana-state"); + let (state2, _, _) = use_local_storage::("banana-state"); view! { Please check [the codec chapter](https://leptos-use.rs/codecs.html) to see what codecs are /// > available and what feature flags they require. /// -/// /// ``` /// # use leptos::*; /// # use leptos_use::{use_event_source, UseEventSourceReturn};