Convert the comp.lang.c
faq to pod. Deals with either the
full or
abridged versions.
#!/usr/bin/perl -w
use strict;
# Add a pod NAME section
print "=head1 NAME\n\n";
print "comp.lang.c Answers to Frequently Asked Questions\n\n";
my $body;
while (<>) {
# Turn the trailing copyright into a pod section
if (/Copyright/ and $body) {
print "=head1 COPYRIGHT\n\n";
}
# Skip the newsgroup header and start from the first copyright not
+ice
if (/Copyright/ and not $body) {
print "=head1 INTRODUCTION\n\n";
$body = 1;
}
# Some simple transformations to convert the test to pod
if ($body) {
s/^(Section\s\d+)/=head1 $1/; # Section 1 headings
s/^(Bibliography)/=head1 $1/; #
s/^(Acknowledgements)/=head1 $1/; #
s/^(\d+\.\d+\w?):\s/=head2 $1 /; # Change faqs to section 2 h
+eadings
s/^(A:)?\t//; # Remove A: and first tab
s/(\w+\(\))/C<$1>/g unless /^\t/; # Add C<> tag to functions i
+n text
print;
}
}
# Add the Author information
print "\n\n=head1 AUTHOR\n\n";
print "Steve Summit (scs\@eskimo.com)\n";