Help:Parser functions in templates/es

When applying ParserFunctions to template parameters, a pipe symbol ("|") may be used to provide a default value, which is used when a parameter is not defined. Used in an #if parser function, the unexpanded text from the undefined parameter will evaluate as true, which may be an unexpected result.


 *  


 * Ejemplo A:  


 * Resultado: 


 *  


 * Ejemplo B:  


 * Result: 

El segundo uso ( , ejemplo B) se usa cuando el contenido es por determinado vacío. Es a menudo una forma de manejar situaciones donde un parámetro existe, pero está ocupado solo por espacios vacíos.

Testing and passing undefined parameters
Una forma de probar si un parametro fue especificado en una llamada de plantilla es este:


 *  

In rare cases, a template behaves differently when a parameter is unspecified compared to when it is specified but empty. When this template is used by a wrapper template (which uses the same set of named parameters), one way to ensure undefined parameters remain undefined is as follows (the technique also works with numbered parameters):

Note that the wrapped_template</tt> receives a specified but empty normal_parameter</tt> in two cases: when normal_parameter</tt> is specified and empty, and when normal_parameter</tt> is unspecified (because the default empty value is then specified by the wrapper template).

By contrast, the wrapped_template</tt> receives a specified sensitive_parameter</tt> only when it is indeed specified, because the #if</tt> changes the wrapped_template</tt> parameter name to « sensitive_parameterNULL</tt> » when sensitive_parameter</tt> is undefined.

Note also that wrapped_template</tt> receives a specified and empty sensitive_parameter</tt> only when the wrapper template receives a specified and empty sensitive_parameter</tt>. Of course, one must make sure the suffixed wrapped_template</tt> parameter name is meaningless to the wrapped_template</tt> for this to work properly.

Véase también

 * Extension:Loops#forargs
 * Extension:Loops#forargs
 * Extension:Loops#forargs