Add support for the 'substitution' filter.

This commit is contained in:
ian%hixie.ch 2003-09-02 15:53:55 +00:00
parent ec0c023645
commit 33203eae13

View File

@ -4,7 +4,7 @@
# Preprocessor # Preprocessor
# Version 1.0 # Version 1.0
# #
# Copyright (c) 2002 by Ian Hickson # Copyright (c) 2002, 2003 by Ian Hickson
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -20,6 +20,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Thanks to bryner and bsmedberg for suggestions.
use strict; use strict;
# takes as arguments the files to process # takes as arguments the files to process
@ -414,4 +416,10 @@ sub slashslash {
return $text; return $text;
} }
sub substitution {
my($stack, $text) = @_;
$text =~ s/@(\w+)@/$stack->get($1)/gose;
return $text;
}
######################################################################## ########################################################################