Name

diff —

ATTRIBUTES

Attribute Pos. Req. Default Description
[ current | curr ] Yes
[ previous | prev ] Yes
flags
context
unified
safe_data
ascii
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

BEHAVIOR

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

EXAMPLES

No examples are available at this time. We do consider this a problem and will try to supply some.

NOTES

AVAILABILITY

diff is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: code/UI_Tag/diff.coretag
Lines: 62


# 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: diff.coretag,v 1.4 2007-03-30 23:40:54 pajamian Exp $

UserTag diff Order       current previous
UserTag diff attrAlias   curr current prev previous
UserTag diff addAttr
UserTag diff Version     $Revision: 1.4 $
UserTag diff Routine     <<EOR
sub {
  my ($curr, $prev, $opt) = @_;

$opt->{flags} .= ' -c' if $opt->{context};
$opt->{flags} .= ' -u' if $opt->{unified};

my $data_opt = {};
$data_opt->{safe_data} = 1 if $opt->{safe_data};

  unless($opt->{flags} =~ /^[-\s\w.]*$/) {
      Log("diff tag: Security violation with flags: $opt->{flags}");
      return "Security violation with flags: $opt->{flags}. Logged.";
  }

  my ($currfn, $prevfn);

  if($curr =~ /^(\w+)::(.*?)::(.*)/) {
      my ($table, $col, $key) = ($1, $2, $3);
      $currfn = "tmp/$Vend::SessionName.current";
  my $data = tag_data($table, $col, $key, $data_opt);
  if ($opt->{ascii}) {
    $data =~ s/\r\n?/\n/g;
    $data .= "\n" unless substr($data, -1, 1) eq "\n";
  }
      Vend::Util::writefile(">$currfn", $data);
  }
  else {
      $currfn = $curr;
  }

  if($prev =~ /^(\w+)::(.*?)::(.*)/) {
      my ($table, $col, $key) = ($1, $2, $3);
      $prevfn = "tmp/$Vend::SessionName.previous";
  my $data = tag_data($table, $col, $key, $data_opt);
  if ($opt->{ascii}) {
    $data =~ s/\r\n?/\n/g;
    $data .= "\n" unless substr($data, -1, 1) eq "\n";
  }
      Vend::Util::writefile(">$prevfn", $data);
  }
  else {
      $prevfn = $prev;
  }

#Debug("diff command: 'diff $opt->{flags} $prevfn $currfn'");
  return `diff $opt->{flags} $prevfn $currfn`;
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

DocBook! Interchange!