💡 Mejora legibilidad de comentarios
This commit is contained in:
		
							parent
							
								
									f5290b477f
								
							
						
					
					
						commit
						f5fb4b7a1d
					
				
					 21 changed files with 74 additions and 68 deletions
				
			
		| 
						 | 
				
			
			@ -52,7 +52,7 @@ impl Favicon {
 | 
			
		|||
        Favicon::default()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Favicon BUILDER *****************************************************************************
 | 
			
		||||
    // **< Favicon BUILDER >************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Le añade un icono genérico apuntando a `image`. El tipo MIME se infiere automáticamente a
 | 
			
		||||
    /// partir de la extensión.
 | 
			
		||||
| 
						 | 
				
			
			@ -152,6 +152,8 @@ impl Favicon {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // **< Favicon RENDER >*************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Renderiza el **Favicon** completo con todas las etiquetas declaradas.
 | 
			
		||||
    ///
 | 
			
		||||
    /// El parámetro `Context` se acepta por coherencia con el resto de *assets*, aunque en este
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -171,7 +171,7 @@ impl JavaScript {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // JavaScript BUILDER **************************************************************************
 | 
			
		||||
    // **< JavaScript BUILDER >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Asocia una **versión** al recurso (usada para control de la caché del navegador).
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -210,6 +210,8 @@ impl Asset for JavaScript {
 | 
			
		|||
        self.weight
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // **< JavaScript RENDER >**********************************************************************
 | 
			
		||||
 | 
			
		||||
    fn render(&self, cx: &mut Context) -> Markup {
 | 
			
		||||
        match &self.source {
 | 
			
		||||
            Source::From(path) => html! {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ impl StyleSheet {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // StyleSheet BUILDER **************************************************************************
 | 
			
		||||
    // **< StyleSheet BUILDER >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Asocia una versión al recurso (usada para control de la caché del navegador).
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +132,7 @@ impl StyleSheet {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // StyleSheet EXTRAS ***************************************************************************
 | 
			
		||||
    // **< StyleSheet HELPERS >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Especifica el medio donde se aplican los estilos.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -163,6 +163,8 @@ impl Asset for StyleSheet {
 | 
			
		|||
        self.weight
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // **< StyleSheet RENDER >**********************************************************************
 | 
			
		||||
 | 
			
		||||
    fn render(&self, cx: &mut Context) -> Markup {
 | 
			
		||||
        match &self.source {
 | 
			
		||||
            Source::From(path) => html! {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ impl AttrClasses {
 | 
			
		|||
        AttrClasses::default().with_value(ClassesOp::Prepend, classes)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrClasses BUILDER *************************************************************************
 | 
			
		||||
    // **< AttrClasses BUILDER >********************************************************************
 | 
			
		||||
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
    pub fn with_value(mut self, op: ClassesOp, classes: impl AsRef<str>) -> Self {
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ impl AttrClasses {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrClasses GETTERS *************************************************************************
 | 
			
		||||
    // **< AttrClasses GETTERS >********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve la cadena de clases, si existe.
 | 
			
		||||
    pub fn get(&self) -> Option<String> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ impl AttrId {
 | 
			
		|||
        AttrId::default().with_value(value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrId BUILDER ******************************************************************************
 | 
			
		||||
    // **< AttrId BUILDER >*************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Establece un identificador nuevo normalizando el valor.
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ impl AttrId {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrId GETTERS ******************************************************************************
 | 
			
		||||
    // **< AttrId GETTERS >*************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve el identificador normalizado, si existe.
 | 
			
		||||
    pub fn get(&self) -> Option<String> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ impl AttrL10n {
 | 
			
		|||
        AttrL10n(value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrL10n BUILDER ****************************************************************************
 | 
			
		||||
    // **< AttrL10n BUILDER >***********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Establece una traducción nueva.
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ impl AttrL10n {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrL10n GETTERS ****************************************************************************
 | 
			
		||||
    // **< AttrL10n GETTERS >***********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve la traducción para `language`, si existe.
 | 
			
		||||
    pub fn lookup(&self, language: &impl LangId) -> Option<String> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ impl AttrName {
 | 
			
		|||
        AttrName::default().with_value(value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrName BUILDER ****************************************************************************
 | 
			
		||||
    // **< AttrName BUILDER >***********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Establece un nombre nuevo normalizando el valor.
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ impl AttrName {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrName GETTERS ****************************************************************************
 | 
			
		||||
    // **< AttrName GETTERS >***********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve el nombre normalizado, si existe.
 | 
			
		||||
    pub fn get(&self) -> Option<String> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ impl AttrValue {
 | 
			
		|||
        AttrValue::default().with_value(value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrValue BUILDER ***************************************************************************
 | 
			
		||||
    // **< AttrValue BUILDER >**********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Establece una cadena nueva normalizando el valor.
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ impl AttrValue {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // AttrValue GETTERS ***************************************************************************
 | 
			
		||||
    // **< AttrValue GETTERS >**********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve la cadena normalizada, si existe.
 | 
			
		||||
    pub fn get(&self) -> Option<String> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ pub enum ErrorParam {
 | 
			
		|||
/// }
 | 
			
		||||
/// ```
 | 
			
		||||
pub trait Contextual: LangId {
 | 
			
		||||
    // Contextual BUILDER **************************************************************************
 | 
			
		||||
    // **< Contextual BUILDER >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Establece el idioma del documento.
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ pub trait Contextual: LangId {
 | 
			
		|||
    #[builder_fn]
 | 
			
		||||
    fn with_assets(self, op: AssetsOp) -> Self;
 | 
			
		||||
 | 
			
		||||
    // Contextual GETTERS **************************************************************************
 | 
			
		||||
    // **< Contextual GETTERS >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve una referencia a la solicitud HTTP asociada, si existe.
 | 
			
		||||
    fn request(&self) -> Option<&HttpRequest>;
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ pub trait Contextual: LangId {
 | 
			
		|||
    /// Devuelve los scripts JavaScript de los recursos del contexto.
 | 
			
		||||
    fn javascripts(&self) -> &Assets<JavaScript>;
 | 
			
		||||
 | 
			
		||||
    // Contextual HELPERS **************************************************************************
 | 
			
		||||
    // **< Contextual HELPERS >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Genera un identificador único por tipo (`<tipo>-<n>`) cuando no se aporta uno explícito.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -255,7 +255,7 @@ impl Context {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Context RENDER ******************************************************************************
 | 
			
		||||
    // **< Context RENDER >*************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Renderiza los recursos del contexto.
 | 
			
		||||
    pub fn render_assets(&mut self) -> Markup {
 | 
			
		||||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ impl Context {
 | 
			
		|||
        markup
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Context PARAMS ******************************************************************************
 | 
			
		||||
    // **< Context PARAMS >*************************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Recupera una *referencia tipada* al parámetro solicitado.
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			@ -389,7 +389,7 @@ impl LangId for Context {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
impl Contextual for Context {
 | 
			
		||||
    // Contextual BUILDER **************************************************************************
 | 
			
		||||
    // **< Contextual BUILDER >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    #[builder_fn]
 | 
			
		||||
    fn with_request(mut self, request: Option<HttpRequest>) -> Self {
 | 
			
		||||
| 
						 | 
				
			
			@ -471,7 +471,7 @@ impl Contextual for Context {
 | 
			
		|||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Contextual GETTERS **************************************************************************
 | 
			
		||||
    // **< Contextual GETTERS >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    fn request(&self) -> Option<&HttpRequest> {
 | 
			
		||||
        self.request.as_ref()
 | 
			
		||||
| 
						 | 
				
			
			@ -530,7 +530,7 @@ impl Contextual for Context {
 | 
			
		|||
        &self.javascripts
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Contextual HELPERS **************************************************************************
 | 
			
		||||
    // **< Contextual HELPERS >*********************************************************************
 | 
			
		||||
 | 
			
		||||
    /// Devuelve un identificador único dentro del contexto para el tipo `T`, si no se proporciona
 | 
			
		||||
    /// un `id` explícito.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue