#!/usr/bin/perl # Script to read all the creole.xml files for every plugin # to produce a summary HTML page (GATE/doc/plugins.html) # by Andrew Golightly # # DO NOT RUN THIS SCRIPT FROM THE COMMAND LINE, use "ant plugins.html" in the # top-level GATE directory instead. use strict; use warnings; use XML::Simple; use XML::XPath; use XML::XPath::XMLParser; use File::Find; if(!@ARGV || $ARGV[0] ne "runningFromAnt") { print "This script should not be run directly. Instead, you should do\n"; print "\"ant plugins.html\" in the top-level GATE directory.\n"; exit 1; } # ********** Some constants ********** my $internalPluginsTitle = "Plugins included in the GATE distribution"; my $externalPluginsTitle = "Other contributed plugins"; # Grab all the creole filenames for all the plugins my @creoleFileList = (); File::Find::find( sub { push (@creoleFileList, $File::Find::name) if $_ eq 'creole.xml'; }, qw(../build/plugins)); # Sort alphabetically, case insensitive @creoleFileList = sort {uc($a) cmp uc($b)} @creoleFileList; # ************************************************** print "Extracting information on GATE plugins\n"; print "--------------------------------------\n\n"; # ********** Write HTML for the top of the plugins page ********** # Open file handle to the HTML file we are creating my $htmlFilename = '../doc/plugins.html'; open(HTMLFILE , ">:utf8", $htmlFilename) || die("Cannot Open File $htmlFilename"); print HTMLFILE < List of plugins available to GATE
GATE

This page lists some of the plugins that are currently available with GATE:

For more information on how the plugins work, see the online user guide "Developing Language Processing Components with GATE".

To submit a plugin, please contact us via the gate-users mailing list.


ENDHTML # ************************************************** # ********** Write internal plugin information to the HTML file ********** print "Extracting internal plugins information..\n"; print HTMLFILE "\n", "

$internalPluginsTitle

\n", "\n", "\n"; # foreach plugin creole.xml file... foreach my $creoleFile (@creoleFileData) { my $creoleFileName = $creoleFile->{NAME}; print "$creoleFileName\n"; print HTMLFILE "\t\n\t\t\n\t\n"; foreach my $node ($creoleFile->{DATA}->get_nodelist) { my $creoleFragment = XML::XPath::XMLParser::as_string($node); print HTMLFILE "\t\n"; # NAME print HTMLFILE "\t\t\n"; # COMMENT and HELPURL print HTMLFILE "\t\t\n"; # CLASS print HTMLFILE "\t\t\n"; print HTMLFILE "\t\n"; } } print HTMLFILE "
$creoleFileName
", $creoleFile->{XPATH}->findvalue('NAME', $node), " ", $creoleFile->{XPATH}->findvalue('COMMENT', $node); if($creoleFile->{XPATH}->exists('HELPURL', $node)) { print HTMLFILE " ({XPATH}->findvalue('HELPURL', $node), "\">docs)"; } print HTMLFILE " ", $creoleFile->{XPATH}->findvalue('CLASS', $node), "
\n", "
\n"; print ".. all internal plugin information extracted.\n\n"; # ************************************************** # ********** Include external-plugins.html page ********** print "Importing external plugins information ... "; print HTMLFILE "\n", "

$externalPluginsTitle

\n"; my $externalPluginsFilename = '../doc/external-plugins.html'; open(EXTERNALHTMLFILE , "<$externalPluginsFilename") || die("Cannot Open File $externalPluginsFilename"); while() { print HTMLFILE; } close(EXTERNALHTMLFILE); print "done!\n"; # ************************************************** # ********** Write the footer images of the plugins page ********** print HTMLFILE <