flams_router_content/
lib.rs

1#![recursion_limit = "256"]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3
4#[cfg(any(
5    all(feature = "ssr", feature = "hydrate", not(feature = "docs-only")),
6    not(any(feature = "ssr", feature = "hydrate"))
7))]
8compile_error!("exactly one of the features \"ssr\" or \"hydrate\" must be enabled");
9
10pub mod backend;
11pub mod components;
12//pub mod errors;
13pub mod server_fns;
14#[cfg(feature = "ssr")]
15mod toc;
16
17pub type Views = ftml_components::Views<backend::FtmlBackend>;
18
19#[cfg(feature = "ssr")]
20mod ssr {
21    use ftml_ontology::utils::Css;
22
23    pub fn insert_base_url(mut v: Box<[Css]>) -> Box<[Css]> {
24        //v.sort();
25        for c in &mut v {
26            if let Css::Link(lnk) = c
27                && let Some(r) = lnk.strip_prefix("srv:")
28            {
29                *lnk = format!(
30                    "{}{r}",
31                    flams_system::settings::Settings::get().external_url()
32                )
33                .into_boxed_str();
34            }
35        }
36        v
37    }
38}