Name

gate — return input verbatim if the specified Scratch variable exists, empty string otherwise

DESCRIPTION

The filter allows "conditional output" of the input string, based on the value of a scratch variable.

In other words, received input is passed through verbatim, if the specified scratch variable holds a true value. Empty string is returned otherwise.

EXAMPLES

Example: Filter example

[set tide]1[/set]

[filter gate.tide]The Gate is open.[/filter]

          

NOTES

AVAILABILITY

gate is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: code/Filter/gate.filter
Lines: 19


# Copyright 2002-2007 Interchange Development Group and others
# Copyright 1996-2002 Red Hat, Inc.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: gate.filter,v 1.4 2007-03-30 23:40:44 pajamian Exp $

CodeDef gate Filter
CodeDef gate Description Gate with scratch
CodeDef gate Routine <<EOR
sub {
my ($val, $var) = @_;
return '' unless $::Scratch->{$var};
return $val;
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

DocBook! Interchange!