esd2texi.pl 690 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#! /usr/bin/perl
#
# This program converts a file containing esd documentation to embedded texi
#

$infile = shift;
$outfile = shift;

$outfile = $infile unless defined $outfile;

open(F,$infile) or die "can not open $infile";
@lines = <F>;
close F;
chomp @lines;

for (@lines){

  s/=verbatim/\@example/;
  s/=noverbatim/\@end example/;
  s/=itemize/\@itemize/;
  s/=noitemize/\@end itemize/;
  s/=item/\@item/;
  s/T<.*;>/\@code\{$1\}/g;
  s/B<.*;>/\@b\{$1\}/g;
  s/I<.*;>/\@emph\{$1\}/g;
  s/R<.*;>/\@xref\{$1\}/g;
  s/=H(.*)$/\@section $1/;
  s/=section.*$//;
  }

open(F,">$outfile") or die "can not open $outfile";
print F join("\n",@lines);
close F;