This is lindent.pl in view mode; [Download] [Up]
#!@@PERL@@ -p
#
# This script is part of rtfdtohtml.
# Copyright (c) 1996 Elmar Ludwig - Universitaet Osnabrueck
#
# Emulate the left- and first-indent settings with tabs.
$indent = defined $ENV{'RTFDLEFTINDENT'} ? $ENV{'RTFDLEFTINDENT'} * 20 : 1500
unless defined $indent;
$num = $old = $li = $fi = 0 unless defined $num;
if (/^\\pard\W/ || /[^\\]\\pard\W/)
{
$li = $fi = 0;
}
if (/^\\li(-?[0-9]+)/ || /[^\\]\\li(-?[0-9]+)/)
{
$li = $1;
}
if (/^\\fi(-?[0-9]+)/ || /[^\\]\\fi(-?[0-9]+)/)
{
$fi = $1;
}
$new = $li + $fi;
$off = $new - $old;
$old = $new;
if ($off >= $indent)
{
++$num;
}
elsif ($off <= -$indent && $num)
{
--$num;
}
$num = 0 if ($new < $indent);
if ($cont)
{
$cont = '' if $_ eq "\\\n" || /[^\\]\\$/;
}
else
{
$cont = '1' unless $_ eq "\\\n" || /[^\\]\\$/;
if ($cont && ($_ eq "\n" || /^\\[^ ]*$/))
{
$cont = '';
}
else
{
$_ = "\t" x $num . $_ if $num;
}
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.