#!/usr/bin/perl -w -CDS # Script to read all the creole.xml files for every plugin # to produce a summary HTML page (GATE/doc/plugins.html) # by Andrew Golightly use strict; use XML::Simple; use XML::XPath; use XML::XPath::XMLParser; # ********** 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 = glob("../plugins/*/creole.xml"); my @elementsToGet = ("NAME", "COMMENT", "CLASS"); # ************************************************** 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 $creoleFileName (@creoleFileList) { $creoleFileName =~ /plugins\/(\w+)\/creole.xml/; print "$1\n"; print HTMLFILE "\t\n\t\t\n\t\n"; my $xp = XML::XPath->new(filename => $creoleFileName); # parse the XML file my $nodeset = $xp->find('//RESOURCE'); # find all resources in this creole.xml file.. foreach my $node ($nodeset->get_nodelist) { my $creoleFragment = XML::XPath::XMLParser::as_string($node); print HTMLFILE "\t\n"; foreach my $elementToGet (@elementsToGet) { print HTMLFILE "\t\t\n"; } print HTMLFILE "\t\n"; } } print HTMLFILE "
$1
", getElement($creoleFragment, $elementToGet), "
\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 <