From 3820593bb8dfdca4e2e17c70b278065b7f7894d9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 29 Mar 2006 10:25:48 +0000 Subject: bringing cxxtest-3.10.1 to ScummVM's main branch svn-id: r21488 --- test/cxxtest/docs/convert.pl | 83 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test/cxxtest/docs/convert.pl (limited to 'test/cxxtest/docs/convert.pl') diff --git a/test/cxxtest/docs/convert.pl b/test/cxxtest/docs/convert.pl new file mode 100644 index 0000000000..9d83f1c0cf --- /dev/null +++ b/test/cxxtest/docs/convert.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl + +die "Usage: $0 \n" + unless scalar @ARGV == 3; + +my ($text, $html, $texi) = @ARGV; + +open TEXT, "<$text" or die "Cannot open text file \"$text\"\n"; +open HTML, ">$html" or die "Cannot create html file \"$html\"\n"; +open TEXI, ">$texi" or die "Cannot create TexInfo file \"$texi\"\n"; + +print HTML ""; + +sub analyze($) { + my ($line) = @_; + my ($htmlLine, $texiLine) = ($line, $line); + + # command line options + $texiLine =~ s/ (--?[a-z-]*)/ \@option{$1}/g; + $htmlLine =~ s/ (--?[a-z-]*)/ $1<\/tt>/g; + + # [Class::]function() + $texiLine =~ s/([^A-Za-z])(([A-Z][A-Za-z0-9]*::)?[A-Za-z0-9]+\(\))/$1\@code{$2}/g; + $htmlLine =~ s/([^A-Za-z])(([A-Z][A-Za-z0-9]*::)?[A-Za-z0-9]+\(\))/$1$2<\/code>/g; + + # `file' + $texiLine =~ s/`([A-Za-z.\/]*)'/\@file{$1}/g; + $htmlLine =~ s/`([A-Za-z.\/]*)'/`$1'<\/tt>/g; + + # TS... + $texiLine =~ s/(^|[^A-Z])(TS[A-Za-z_*()]*)/$1\@code{$2}/g; + $htmlLine =~ s/(^|[^A-Z])(TS[A-Za-z_*()]*)/$1$2<\/code>/g; + + # CXXTEST_ + $texiLine =~ s/(CXXTEST_[A-Z_]*)/\@code{$1}/g; + $htmlLine =~ s/(CXXTEST_[A-Z_]*)/$1<\/tt>/g; + + return ($htmlLine, $texiLine); +} + +my $line; +my $inRelease = 0; +while ( defined( $line = ) ) { + chomp $line; + if ( $line =~ m/^CxxTest Releases/ ) { + print HTML "CxxTest Releases\n"; + print HTML "

CxxTest Releases

\n\n"; + + print TEXI "\@appendix Version history\n"; + print TEXI "\@itemize \@bullet\n"; + } + elsif ( $line =~ m/^(.*):$/ ) { + if ( $inRelease ) { + print HTML "\n\n"; + print TEXI "\@end itemize\n"; + } + + print HTML "

$1

\n"; + print HTML "
    \n"; + + print TEXI "\@item\n\@strong{$1}\n"; + print TEXI "\@itemize \@minus\n"; + + $inRelease = 1; + } + elsif ( $line =~ m/^ - (.*)$/ ) { + my ($htmlLine, $texiLine) = analyze($1); + print HTML "
  • $htmlLine
  • \n"; + print TEXI "\@item\n$texiLine\n"; + } +} + +if ( $inRelease ) { + print HTML "
\n\n"; + print TEXI "\@end itemize\n\n"; +} + +print HTML "\n"; +print TEXI "\@end itemize\n"; + +close TEXT or die "Error closing text file \"$text\"\n"; +close HTML or die "Error closing html file \"$html\"\n"; +close TEXI or die "Error closing TexInfo file \"$texi\"\n"; -- cgit v1.2.3