WIP: Añade componente para la gestión de menús #8

Draft
manuelcillero wants to merge 54 commits from add-menu-component into main
4 changed files with 8 additions and 9 deletions
Showing only changes of commit 4381db018e - Show all commits

View file

@ -277,8 +277,7 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream {
.collect(); .collect();
// Documentación del método alter_...(). // Documentación del método alter_...().
let alter_doc = let doc = format!("Equivale a [`Self::{with_name_str}()`], pero fuera del patrón *builder*.");
format!("Equivalente a [`Self::{with_name_str}()`], pero fuera del patrón *builder*.");
// Genera el código final. // Genera el código final.
let expanded = match body_opt { let expanded = match body_opt {
@ -288,7 +287,7 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream {
fn #with_name #generics (self, #(#args),*) -> Self #where_clause; fn #with_name #generics (self, #(#args),*) -> Self #where_clause;
#(#non_doc_or_inline_attrs)* #(#non_doc_or_inline_attrs)*
#[doc = #alter_doc] #[doc = #doc]
fn #alter_ident #generics (&mut self, #(#args),*) -> &mut Self #where_clause; fn #alter_ident #generics (&mut self, #(#args),*) -> &mut Self #where_clause;
} }
} }
@ -322,7 +321,7 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream {
#with_fn #with_fn
#(#non_doc_or_inline_attrs)* #(#non_doc_or_inline_attrs)*
#[doc = #alter_doc] #[doc = #doc]
#vis_pub fn #alter_ident #generics (&mut self, #(#args),*) -> &mut Self #where_clause { #vis_pub fn #alter_ident #generics (&mut self, #(#args),*) -> &mut Self #where_clause {
#body #body
} }

View file

@ -91,7 +91,7 @@ impl Block {
&self.classes &self.classes
} }
/// Devuelve el título del bloque como [`L10n`]. /// Devuelve el título del bloque.
pub fn title(&self) -> &L10n { pub fn title(&self) -> &L10n {
&self.title &self.title
} }

View file

@ -237,7 +237,7 @@ impl Intro {
/// ///
/// ```rust /// ```rust
/// # use pagetop::prelude::*; /// # use pagetop::prelude::*;
/// let intro = Intro::default().with_title(L10n::n("Título de entrada")); /// let intro = Intro::default().with_title(L10n::n("Intro title"));
/// ``` /// ```
#[builder_fn] #[builder_fn]
pub fn with_title(mut self, title: L10n) -> Self { pub fn with_title(mut self, title: L10n) -> Self {
@ -251,7 +251,7 @@ impl Intro {
/// ///
/// ```rust /// ```rust
/// # use pagetop::prelude::*; /// # use pagetop::prelude::*;
/// let intro = Intro::default().with_slogan(L10n::n("Un eslogan para la entrada")); /// let intro = Intro::default().with_slogan(L10n::n("A short slogan"));
/// ``` /// ```
#[builder_fn] #[builder_fn]
pub fn with_slogan(mut self, slogan: L10n) -> Self { pub fn with_slogan(mut self, slogan: L10n) -> Self {
@ -270,7 +270,7 @@ impl Intro {
/// ```rust /// ```rust
/// # use pagetop::prelude::*; /// # use pagetop::prelude::*;
/// // Define un botón con texto y una URL fija. /// // Define un botón con texto y una URL fija.
/// let intro = Intro::default().with_button(Some((L10n::n("Pulsa este botón"), |_| "/start"))); /// let intro = Intro::default().with_button(Some((L10n::n("Learn more"), |_| "/start")));
/// // Descarta el botón de la intro. /// // Descarta el botón de la intro.
/// let intro_no_button = Intro::default().with_button(None); /// let intro_no_button = Intro::default().with_button(None);
/// ``` /// ```

View file

@ -21,7 +21,7 @@ pub type ExtensionRef = &'static dyn Extension;
/// ///
/// impl Extension for Blog { /// impl Extension for Blog {
/// fn name(&self) -> L10n { L10n::n("Blog") } /// fn name(&self) -> L10n { L10n::n("Blog") }
/// fn description(&self) -> L10n { L10n::n("Sistema de blogs") } /// fn description(&self) -> L10n { L10n::n("Blog system") }
/// } /// }
/// ``` /// ```
pub trait Extension: AnyInfo + Send + Sync { pub trait Extension: AnyInfo + Send + Sync {