Add support for the 'substitution' filter.

git-svn-id: svn://10.0.0.236/trunk@146515 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ian%hixie.ch
2003-09-02 15:53:55 +00:00
parent d6f51ea339
commit 2e15917fdf

View File

@@ -4,7 +4,7 @@
# Preprocessor
# 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
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Thanks to bryner and bsmedberg for suggestions.
use strict;
# takes as arguments the files to process
@@ -414,4 +416,10 @@ sub slashslash {
return $text;
}
sub substitution {
my($stack, $text) = @_;
$text =~ s/@(\w+)@/$stack->get($1)/gose;
return $text;
}
########################################################################