space_to_nbsp — replace all spaces (" ") with nonbreakable space (" ") characters
The filter replaces all space (" ") characters
with HTML's nonbreakable-space (" ")
characters.
This is useful for places where you want strings to appear in a single line, without word-wrapping to the next line.
Example: Filter example
<div style="width: 80px;"> This is a very small DIV and will surely word-wrap this text to multiple lines. With the filter applied, however, it will force the DIV to stretch and render as single line. </div> <div style="width: 80px;"> [filter space_to_nbsp] With the filter applied, however, it will force the DIV to stretch and render as single line. [/filter] </div>Example in action:
<div style="width: 80px;">
This is a very small DIV and will surely word-wrap this text to multiple lines.
With the filter applied, however, it will force the DIV to stretch and render as single line.
</div>
<div style="width: 80px;">
With the filter applied, however, it will force the DIV to stretch and render as single line.
</div>
Example: Filter example
<div> [filter space_to_nbsp.compress] Multiple spaces in a line will render as just single space. [/filter] </div>Example in action:
<div>
Multiple spaces in a line will render as just single space.
</div>
In HTML, multiple spaces in a line render as just one space on the
screen. When the spaces are converted to " ", however, every
nonbreakable space will produce one space character on the screen —
it's how HTML works.
Use the filter's compress when you want to
preserve the behavior of only one space being visible on the screen.
Interchange 5.9.0:
Source: code/Filter/space_to_nbsp.filter
Lines: 24
# Copyright 2002-2007 Interchange Development Group and others
#
# 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: space_to_nbsp.filter,v 1.3 2007-03-30 23:40:45 pajamian Exp $
CodeDef space_to_nbsp Filter
CodeDef space_to_nbsp Description All SPACE to nbsp
CodeDef space_to_nbsp Routine <<EOR
sub {
my ($str, $tag, $opt) = @_;
if ( $opt ) {
$str =~ s/ +/ /g;
} else {
$str =~ s/ / /g;
}
$str;
}
EOR