aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdocs/autodocifier.pl28
1 files changed, 16 insertions, 12 deletions
diff --git a/docs/autodocifier.pl b/docs/autodocifier.pl
index 67e43b2d5..753ba3a9b 100755
--- a/docs/autodocifier.pl
+++ b/docs/autodocifier.pl
@@ -26,15 +26,12 @@ sub beautify {
26 $text =~ s/"\s*"//sg; 26 $text =~ s/"\s*"//sg;
27 my @line = split("\n", $text); 27 my @line = split("\n", $text);
28 $text = join('', 28 $text = join('',
29 map { eval }
30 map { qq[ sprintf(qq#$_#) ] }
31 map { 29 map {
32 s/^\s*//; 30 s/^\s*//;
33 s/"//g; 31 s/"//g;
34 s/% /%% /g; 32 s/%/%%/g;
35 $_ 33 eval qq[ sprintf(qq#$_#) ]
36 } 34 } @line
37 @line
38 ); 35 );
39 return $text; 36 return $text;
40} 37}
@@ -47,13 +44,13 @@ sub pod_for_usage {
47 # make options bold 44 # make options bold
48 my $trivial = $usage->{trivial}; 45 my $trivial = $usage->{trivial};
49 $trivial =~s/(?<!\w)(-\w+)/B<$1>/sxg; 46 $trivial =~s/(?<!\w)(-\w+)/B<$1>/sxg;
50 my @f1;
51 my @f0 = 47 my @f0 =
52 map { $_ !~ /^\s/ && s/(?<!\w)(-\w+)/B<$1>/g; $_ } 48 map { $_ !~ /^\s/ && s/(?<!\w)(-\w+)/B<$1>/g; $_ }
53 split("\n", $usage->{full}); 49 split("\n", $usage->{full});
54 50
55 # add "\n" prior to certain lines to make indented 51 # add "\n" prior to certain lines to make indented
56 # lines look right 52 # lines look right
53 my @f1;
57 my $len = @f0; 54 my $len = @f0;
58 for (my $i = 0; $i < $len; $i++) { 55 for (my $i = 0; $i < $len; $i++) {
59 push @f1, $f0[$i]; 56 push @f1, $f0[$i];
@@ -76,7 +73,7 @@ sub pod_for_usage {
76 ; 73 ;
77} 74}
78 75
79# generate SGML for an applet 76# FIXME | generate SGML for an applet
80sub sgml_for_usage { 77sub sgml_for_usage {
81 my $name = shift; 78 my $name = shift;
82 my $usage = shift; 79 my $usage = shift;
@@ -96,7 +93,9 @@ sub sgml_for_usage {
96# } 93# }
97my %docs; 94my %docs;
98 95
96
99# get command-line options 97# get command-line options
98
100my %opt; 99my %opt;
101 100
102GetOptions( 101GetOptions(
@@ -118,7 +117,9 @@ if (defined $opt{help}) {
118 exit 1; 117 exit 1;
119} 118}
120 119
120
121# collect documenation into %docs 121# collect documenation into %docs
122
122foreach (@ARGV) { 123foreach (@ARGV) {
123 open(USAGE, $_) || die("$0: $!"); 124 open(USAGE, $_) || die("$0: $!");
124 my $fh = *USAGE; 125 my $fh = *USAGE;
@@ -138,13 +139,16 @@ foreach (@ARGV) {
138 } 139 }
139} 140}
140 141
142
143# generate structured documentation
144
141my $generator = \&pod_for_usage; 145my $generator = \&pod_for_usage;
142if (defined $opt{sgml}) { 146if (defined $opt{sgml}) {
143 $generator = \&sgml_for_usage; 147 $generator = \&sgml_for_usage;
144} 148}
145 149
146foreach my $name (sort keys %docs) { 150foreach my $applet (sort keys %docs) {
147 print $generator->($name, $docs{$name}); 151 print $generator->($applet, $docs{$applet});
148} 152}
149 153
150exit 0; 154exit 0;
@@ -207,4 +211,4 @@ John BEPPU <beppu@lineo.com>
207 211
208=cut 212=cut
209 213
210# $Id: autodocifier.pl,v 1.10 2001/02/23 17:55:03 beppu Exp $ 214# $Id: autodocifier.pl,v 1.11 2001/02/24 14:37:48 beppu Exp $