Name

column — display column in a text-formatted row

ATTRIBUTES

Attribute Pos. Req. Default Description
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

As of Interchange 4.9, this tag is part of tag [row] — please refer to it for all documentation.

BEHAVIOR

This tag does not appear to be affected by, or affect, the rest of Interchange.

EXAMPLES

Example: Using column

<pre>
Position 10        20        30        40        50

[row 60]
	[column width=19]ITEM NR #1[/column]
	[column width=19]ITEM PRICE[/column]
[/row]
</pre>

          

NOTES

AVAILABILITY

column is available in Interchange versions:

4.6.0, 4.8.0

SOURCE

Interchange 4.8.0:

Source: lib/Vend/Interpolate.pm (rev. 2.9.2.29 from Fri Jan 24 06:51:52 2003)
Lines: 6680

sub tag_column {
my($spec,$text) = @_;
my($append,$f,$i,$line,$usable);
my(%def) = qw(
        width 0
        spacing 1
        gutter 2
        wrap 1
        html 0
        align left
      );
my(%spec)  = ();
my(@out)  = ();
my(@lines)  = ();

$spec =~ s/\n/ /g;
$spec =~ s/^\s+//;
$spec =~ s/\s+$//;
$spec = lc $spec;

$spec =~ s/\s*=\s*/=/;
$spec =~ s/^(\d+)/width=$1/;
%spec = split /[\s=]+/, $spec;

for(keys %def) {
  $spec{$_} = $def{$_} unless defined $spec{$_};
}

if($spec{'html'} && $spec{'wrap'}) {
  ::logError("tag_column: can't have 'wrap' and 'html' specified at same time.");
  $spec{wrap} = 0;
}

if(! $spec{align} or $spec{align} !~ /^n/i) {
  $text =~ s/\s+/ /g;
}

my $len = sub {
  my($txt) = @_;
  if (1 or $spec{html}) {
    $txt =~
    s{ <
         (
         [^>'"] +
          |
         ".*?"
          |
         '.*?'
        ) +
      >
    }{}gsx;
  }
  return length($txt);
};

$usable = $spec{'width'} - $spec{'gutter'};
return "BAD_WIDTH" if  $usable < 1;

if($spec{'align'} =~ /^[ln]/i) {
  $f = sub {
        $_[0] .
        ' ' x ($usable - $len->($_[0])) .
        ' ' x $spec{'gutter'};
        };
}
elsif($spec{'align'} =~ /^r/i) {
  $f = sub {
        ' ' x ($usable - $len->($_[0])) .
        $_[0] .
        ' ' x $spec{'gutter'};
        };
}
elsif($spec{'align'} =~ /^i/i) {
  $spec{'wrap'} = 0;
  $usable = 9999;
  $f = sub { @_ };
}
else {
  return "BAD JUSTIFICATION SPECIFICATION: $spec{'align'}";
}

$append = '';
if($spec{'spacing'} > 1) {
  $append .= "\n" x ($spec{'spacing'} - 1);
}

if($spec{'align'} =~ /^n/i) {
  @lines = split(/\r?\n/, $text);
}
elsif(is_yes($spec{'wrap'}) and length($text) > $usable) {
  @lines = wrap($text,$usable);
}
elsif($spec{'align'} =~ /^i/i) {
  $lines[0] = ' ' x $spec{'width'};
  $lines[1] = $text . ' ' x $spec{'gutter'};
}
elsif (! $spec{'html'}) {
  $lines[0] = substr($text,0,$usable);
}

foreach $line (@lines) {
  push @out , &{$f}($line);
  for($i = 1; $i < $spec{'spacing'}; $i++) {
    push @out, '';
  }
}
@out;
}

AUTHORS

Interchange Development Group

SEE ALSO

DocBook! Interchange!