X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=docs%2Fexdoc;h=92027663e6d6f7244b55fdcf8fa4f33a05f504c8;hb=098e88f3a87205d92516a1fe912b6f84164d0a59;hp=7ee86e7d7712c81da5165eb1d4abd9951a288c12;hpb=2c18735a5d5faad5cfb91b83e03b26620c4545d2;p=mono.git diff --git a/docs/exdoc b/docs/exdoc index 7ee86e7d771..92027663e6d 100644 --- a/docs/exdoc +++ b/docs/exdoc @@ -1,464 +1,502 @@ #!/usr/bin/perl -if ($ARGV[0] eq "-h"){ - $sourcedir = $ARGV[1]; - $dir = $sourcedir; - $html = 1; - shift @ARGV; - shift @ARGV; -} +use warnings; +use strict; -if ($ARGV[0] eq "-t"){ - $dir = $ARGV[1]; - shift @ARGV; -} +use Getopt::Long; +use Pod::Usage; -if ($html){ - opendir (D, "$sourcedir/sources/") || die "Can not open $dir"; - while ($n = readdir (D)){ - if ($n =~ /mono-api-.*\.html$/){ - open (IN, "$sourcedir/sources/$n") || die "Can not open $n"; - $files[$filecount] = $n; - while (){ - @files_content[$filecount] .= $_; - if (/name="api:(.*?)"/){ - $_ =~ s/.*name="api:(\w+?)".*/\1/; - $apis[$filecount] .= "$_"; - } - } - $filecount++; - close IN; - } - } -} +# Options +my $HELP = 0; +my $SOURCE_DIR = ''; +my $TARGET_DIR = ''; +my $WARNINGS = 0; -while (){ - if (/\/\*\* *\n/){ - &process_doc; - } else { - #print "IGNORING: $_"; - } -} +GetOptions( + "help" => \$HELP, + "html|h=s" => \$SOURCE_DIR, + "target|t=s" => \$TARGET_DIR, + "warnings|W" => \$WARNINGS, +) or pod2usage(1); -if ($html){ - for ($f = 0; $f < $filecount; $f++){ - $name = $files[$f]; - open (OUT, "> $dir/html/$name") || die "Can not create $dir/html/$name"; - print "Merging: $name\n"; - print OUT< - - - $name - -
+
EOF - @a = split (/\n/, $files_content[$f]); - $strikeextra = ""; - for ($ai = 0; $ai < $#a; $ai++){ - $line = $a[$ai]; - - ($api,$caption) = $line =~ /

(\w+)<\/a><\/h4>/; - if ($api ne ""){ - if ($api_shown == 1){ - print OUT "

\n\n"; - if ($deprecated{$api}){ - $strike = "strike"; - $strikeextra = "

\n\n"; + if ($docs->{deprecated}->{$api}) { + $strike = "mapi-strike"; + $strikeextra = "
Deprecated: " . $docs->{deprecated}->{$api}; + } else { + $strike = ""; + $strikeextra = ""; + } + } + $api_shown = 1; + my $proto = $docs->{prototype}->{$api} // $api; + + print $output_file < -
-
$api$strikeextra
-
-
-
-
- -
Syntax
-
$proto
+
+
$api$strikeextra
+
+
+
+
+ +
Syntax
+
$proto

EOF - -# if ($arguments{$api} ne "" && (!($arguments{$api}) =~ /^[ \t]+$/)){ - print OUT "

Parameters
\n"; - print OUT " ".${arguments{$api}}."
"; -# } -# &opt_print ("Parameters", $arguments{$api}, 1); - - &opt_print ("Returns", $returns{$api}, 1); - &opt_print ("Description", $bodies{$api}, 0); - print OUT "
\n
\n"; - } else { - if ($line =~ /@API_IDX@/){ - $apis_toc = &create_toc ($apis[$f]); - $line =~ s/\@API_IDX\@/$apis_toc/; - } - if ($line =~ /^

\n"; - $api_shown = 0; - } - if ($line =~ /`/){ - } - print OUT "$line\n"; - } - } - print OUT< - - -EOF - close OUT; - system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name"); - - # clean up the mess that AgilityPack does, it CDATAs our CSS - open HACK, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name"; - open HACKOUT, ">$dir/deploy/$name" || die "Could not open output"; - - while (){ - s/^\/\/\/\///; - print HACKOUT $_; - } - #system ("cp.exe $dir/html/$name $dir/deploy/$name"); + if (exists ($docs->{parameters}->{$api})) { + my $ppars = $docs->{parameters}->{$api}; + if (@$ppars) { + print $output_file + "
Parameters
\n", + " ", + render_parameters($ppars), + "
"; + } + } + + opt_print ($output_file, "Return value", $docs->{return}->{$api}); + opt_print ($output_file, "Description", $docs->{body}->{$api}); + print $output_file "

\n
\n"; + } else { + if ($line =~ /\@API_IDX\@/) { + my $apis_toc = create_toc ($docs, $templates->{$name}->{api}); + $line =~ s/\@API_IDX\@/$apis_toc/; + } + if ($line =~ /^

\n"; + $api_shown = 0; + } + if ($line =~ /`/) { + } + print $output_file "$line\n"; + } + } + print $output_file + "

", + "", + ""; + close $output_file; + system ("$ENV{runtimedir}/mono-wrapper convert.exe $TARGET_DIR/html/$name $TARGET_DIR/html/x-$name"); + + # Clean up the mess that AgilityPack makes (it CDATAs our CSS). + open (my $hack_input, '<', "$TARGET_DIR/html/x-$name") + or die "Could not open $TARGET_DIR/html/x-$name"; + open (my $hack_output, '>', "$TARGET_DIR/deploy/$name") + or die "Could not open output"; + + my $line = 0; + my $doprint = 0; + while (<$hack_input>) { + print $hack_output $last if ($doprint); + $line++; + s/^\/\/\/\///; + + # Remove the junk wrapper generated by AgilityPack. + if ($line==1) { + s///; + } + if (/