diff options
author | John Beppu | 2001-02-24 14:37:48 +0000 |
---|---|---|
committer | John Beppu | 2001-02-24 14:37:48 +0000 |
commit | 7d597c4833bfa048cd3ddbc9f5d9d6cf752a97d1 (patch) | |
tree | 8ba0f1b8cb39c10d7059960d54e00de9fe27c400 | |
parent | dbfff6cbde0231e4904be1be97ee699ca4cae682 (diff) | |
download | busybox-7d597c4833bfa048cd3ddbc9f5d9d6cf752a97d1.zip busybox-7d597c4833bfa048cd3ddbc9f5d9d6cf752a97d1.tar.gz |
refinement
-rwxr-xr-x | docs/autodocifier.pl | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/docs/autodocifier.pl b/docs/autodocifier.pl index 67e43b2..753ba3a 100755 --- a/docs/autodocifier.pl +++ b/docs/autodocifier.pl @@ -26,15 +26,12 @@ sub beautify { $text =~ s/"\s*"//sg; my @line = split("\n", $text); $text = join('', - map { eval } - map { qq[ sprintf(qq#$_#) ] } map { s/^\s*//; s/"//g; - s/% /%% /g; - $_ - } - @line + s/%/%%/g; + eval qq[ sprintf(qq#$_#) ] + } @line ); return $text; } @@ -47,13 +44,13 @@ sub pod_for_usage { # make options bold my $trivial = $usage->{trivial}; $trivial =~s/(?<!\w)(-\w+)/B<$1>/sxg; - my @f1; my @f0 = map { $_ !~ /^\s/ && s/(?<!\w)(-\w+)/B<$1>/g; $_ } split("\n", $usage->{full}); # add "\n" prior to certain lines to make indented # lines look right + my @f1; my $len = @f0; for (my $i = 0; $i < $len; $i++) { push @f1, $f0[$i]; @@ -76,7 +73,7 @@ sub pod_for_usage { ; } -# generate SGML for an applet +# FIXME | generate SGML for an applet sub sgml_for_usage { my $name = shift; my $usage = shift; @@ -96,7 +93,9 @@ sub sgml_for_usage { # } my %docs; + # get command-line options + my %opt; GetOptions( @@ -118,7 +117,9 @@ if (defined $opt{help}) { exit 1; } + # collect documenation into %docs + foreach (@ARGV) { open(USAGE, $_) || die("$0: $!"); my $fh = *USAGE; @@ -138,13 +139,16 @@ foreach (@ARGV) { } } + +# generate structured documentation + my $generator = \&pod_for_usage; if (defined $opt{sgml}) { - $generator = \&sgml_for_usage; + $generator = \&sgml_for_usage; } -foreach my $name (sort keys %docs) { - print $generator->($name, $docs{$name}); +foreach my $applet (sort keys %docs) { + print $generator->($applet, $docs{$applet}); } exit 0; @@ -207,4 +211,4 @@ John BEPPU <beppu@lineo.com> =cut -# $Id: autodocifier.pl,v 1.10 2001/02/23 17:55:03 beppu Exp $ +# $Id: autodocifier.pl,v 1.11 2001/02/24 14:37:48 beppu Exp $ |