yesno
If the body text is not empty then return "Yes",
otherwise return "No".
A locale-specific translation of "Yes" or "No" will be returned if defined.
White space is considered to be non-empty,
you you may want to pre-filter the body text with
"strip" before calling this filter.
Example
|
[filter yesno]Kevin Walsh[/filter]
|
Results in:
Source code
sub {
my $val = shift(@_) ? 'Yes' : 'No';
return $val unless $Vend::Cfg->{Locale};
return $val unless defined $Vend::Cfg->{Locale}{$val};
return $Vend::Cfg->{Locale}{$val};
}
|