[interchange-cvs] interchange - docelic modified
code/Filter/space_to_nbsp.filter
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sat Feb 17 08:20:57 EST 2007
User: docelic
Date: 2007-02-17 13:20:57 GMT
Modified: code/Filter space_to_nbsp.filter
Log:
* Add ability to compress multiple spaces to single space, because
when they're turned to s, they each render on screen, which
you might now want.
Use [filter space_to_nbsp] for the usual 1-to-1 replacement, and
[filter space_to_nbsp.compress] for N-to-1 replacement.
Revision Changes Path
1.2 +10 -4 interchange/code/Filter/space_to_nbsp.filter
rev 1.2, prev_rev 1.1
Index: space_to_nbsp.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/space_to_nbsp.filter,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- space_to_nbsp.filter 17 Feb 2007 12:39:18 -0000 1.1
+++ space_to_nbsp.filter 17 Feb 2007 13:20:56 -0000 1.2
@@ -1,13 +1,19 @@
# Copyright 2002-2007 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: space_to_nbsp.filter,v 1.1 2007/02/17 12:39:18 docelic Exp $
+# $Id: space_to_nbsp.filter,v 1.2 2007/02/17 13:20:56 docelic Exp $
CodeDef space_to_nbsp Filter
CodeDef space_to_nbsp Description All SPACE to nbsp
CodeDef space_to_nbsp Routine <<EOR
sub {
- my $str = shift;
- $str =~ s/ / /g;
- return $str;
+ my ($str, $tag, $opt) = @_;
+
+ if ( $opt ) {
+ $str =~ s/ +/ /g;
+ } else {
+ $str =~ s/ / /g;
+ }
+
+ $str;
}
EOR
More information about the interchange-cvs
mailing list