📝 Añade no_run a doctests ilustrativos
This commit is contained in:
parent
41c4379bc3
commit
511149caa7
26 changed files with 57 additions and 57 deletions
|
|
@ -27,7 +27,7 @@ pub use context::{AssetsOp, Context, ContextError, Contextual};
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// #[derive(AutoDefault, Clone)]
|
||||
/// struct SampleComponent {
|
||||
|
|
@ -81,7 +81,7 @@ pub type FnIsRenderable = fn(cx: &Context) -> bool;
|
|||
/// El caso más común es construir rutas relativas dependientes del contexto, normalmente usando
|
||||
/// [`Context::route`](crate::core::component::Context::route):
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # let relative_route: FnPathByContext =
|
||||
/// |cx| cx.route("/path/to/page")
|
||||
|
|
@ -90,7 +90,7 @@ pub type FnIsRenderable = fn(cx: &Context) -> bool;
|
|||
///
|
||||
/// También es posible usar rutas estáticas sin asignaciones adicionales:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # let external_route: FnPathByContext =
|
||||
/// |_| "https://www.example.com".into()
|
||||
|
|
@ -99,7 +99,7 @@ pub type FnIsRenderable = fn(cx: &Context) -> bool;
|
|||
///
|
||||
/// O componer rutas dinámicas en tiempo de ejecución:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # let dynamic_route: FnPathByContext =
|
||||
/// |cx| RoutePath::new("/user").with_param("id", cx.param::<u64>("user_id").unwrap().to_string())
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ impl<C: Component> Embed<C> {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// let embed = Embed::with(Html::with(|_| html! { "Prueba" }));
|
||||
/// {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ impl std::error::Error for ContextError {}
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_aliner::Aliner;
|
||||
/// fn prepare_context<C: Contextual>(cx: C) -> C {
|
||||
|
|
@ -123,7 +123,7 @@ pub trait Contextual: LangId {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// let cx = Context::new(None)
|
||||
/// .with_param("user_id", 42_i32)
|
||||
|
|
@ -232,7 +232,7 @@ pub trait Contextual: LangId {
|
|||
///
|
||||
/// Crea un nuevo contexto asociado a una petición HTTP:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_aliner::Aliner;
|
||||
/// fn new_context(request: HttpRequest) -> Context {
|
||||
|
|
@ -254,7 +254,7 @@ pub trait Contextual: LangId {
|
|||
///
|
||||
/// Y hace operaciones con un contexto dado:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # #[derive(AutoDefault, Clone, Debug)]
|
||||
/// # struct Menu;
|
||||
|
|
@ -409,7 +409,7 @@ impl Context {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # let mut cx = Context::new(None);
|
||||
/// cx.push_message(MessageLevel::Warning, L10n::n("Session is not valid"));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::{AutoDefault, Getters};
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # #[derive(Clone)]
|
||||
/// # struct MyComponent;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub enum MessageLevel {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// // Mensaje informativo con clave traducible.
|
||||
/// let info = StatusMessage::new(MessageLevel::Info, L10n::l("saved-successfully"));
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::web::Router;
|
|||
/// Este *trait* es fácil de implementar, basta con declarar una estructura sin campos para la
|
||||
/// extensión y sobrescribir los métodos que sean necesarios. Por ejemplo:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// pub struct MyExtension;
|
||||
///
|
||||
|
|
@ -48,7 +48,7 @@ pub trait Extension: AnyInfo + Send + Sync {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// pub struct MyTheme;
|
||||
///
|
||||
|
|
@ -107,7 +107,7 @@ pub trait Extension: AnyInfo + Send + Sync {
|
|||
///
|
||||
/// ## Rutas HTTP básicas
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # async fn list_posts() -> &'static str { "" }
|
||||
/// # async fn view_post() -> &'static str { "" }
|
||||
|
|
@ -126,7 +126,7 @@ pub trait Extension: AnyInfo + Send + Sync {
|
|||
///
|
||||
/// ## Rutas agrupadas bajo un prefijo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// # async fn dashboard() -> &'static str { "" }
|
||||
/// # async fn list_users() -> &'static str { "" }
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use crate::web::http::StatusCode;
|
|||
/// El único método **obligatorio** de `Extension` para un tema es [`theme()`](Extension::theme),
|
||||
/// que debe devolver una referencia al propio tema:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// pub struct MyTheme;
|
||||
///
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ impl ChildrenInRegions {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// // Banner global en la región de contenido.
|
||||
/// InRegion::Content.add(Html::with(|_| html! { "🎉 ¡Bienvenido!" }));
|
||||
|
|
@ -157,7 +157,7 @@ impl InRegion {
|
|||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,no_run
|
||||
/// # use pagetop::prelude::*;
|
||||
/// // Banner global en la región por defecto.
|
||||
/// InRegion::Content.add(Html::with(|_| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue