From: Egon W. <eg...@us...> - 2002-07-20 14:25:37
|
Update of /cvsroot/woc/woc/bin/index In directory usw-pr-cvs1:/tmp/cvs-serv23020/bin/index Modified Files: .cvsignore Makefile.am index.abbrev.xsl makechemtrans.sh templindex.XX-XX.xsl woclist.sh.in Added Files: genlangxslts.pl.in index.smiles2cas.xsl update.sh.in woclist.pl.in Removed Files: genlangxslts.pl update.pl woclist.pl Log Message: Made index scripts work. --- NEW FILE: genlangxslts.pl.in --- #! @PATHTOPERL@ -w use strict; use diagnostics; my %langs = ( "NL" => { "EN" => "Dutch", "NL" => "Nederlands", }, "EN" => { "EN" => "English", "NL" => "Engels", }, "DE" => { "EN" => "German", "NL" => "Duits", }, "IT" => { "EN" => "Italian", "NL" => "Italiaans", }, "FR" => { "EN" => "French", "NL" => "Frans", }, "ES" => { "EN" => "Spanish", "NL" => "Spaans", }, "LA" => { "EN" => "Latin", "NL" => "Latijn", }, "FY" => { "EN" => "Frysian", "NL" => "Fries", }, ); foreach my $from (keys(%langs)) { foreach my $to (keys(%langs)) { print "$from -> $to$/"; open(INPUT, "<templindex.XX-XX.xsl"); open(OUTPUT, ">index.$from-$to.xsl"); while(<INPUT>) { s/#FROM#/$from/; s/#TO#/$to/; print OUTPUT; } } } open(OUTPUT, ">makechemtrans.sh"); print OUTPUT "#! @PATHTOSH@\n"; print OUTPUT "# This script is autogenerated with genlangxslts.pl! Do not edit!\n\n"; print OUTPUT "all=\""; foreach my $from (keys(%langs)) { foreach my $to (keys(%langs)) { if ($from ne $to) { print OUTPUT "index.$from-$to \\\n"; } } } print OUTPUT "\"\n\n"; print OUTPUT "update.sh \$all\n"; `chmod 755 makechemtrans.sh` --- NEW FILE: index.smiles2cas.xsl --- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output mode="html"/> <xsl:template match="/"> <html> <head> <base href="http://www.sci.kun.nl/woc/"/> <link rel="stylesheet" href="http://www.sci.kun.nl/woc/gui/styles/woc.css" type="text/css"/> <script src="gui/javascript/isframe.js"></script> <script src="gui/javascript/browsertest.js"></script> <script src="gui/javascript/location.js"></script> <script><xsl:comment> setLocation("Nederlands-Engels"); // </xsl:comment> </script> </head> <body class="main"> <hr/> <xsl:apply-templates select="woclist" /> <hr/> </body> </html> </xsl:template> <xsl:template match="NAME"> <xsl:apply-templates/> </xsl:template> <xsl:template match="woclist"> <table border="0" celpadding="0" cellspacing="0" width="100%"> <xsl:for-each select="ITEM"> <xsl:sort select="INDEX[@CLASS='SMILES']"/> <xsl:for-each select="INDEX[@CLASS='SMILES']"> <xsl:if test="."> <tr> <td class="main"><a href="http://www.sci.kun.nl/woc/gui/items/{../@FILE}.shtml"><xsl:value-of select="."/></a></td> <td class="main"><xsl:value-of select="../INDEX[@CLASS='CAS-NUMBER']"/></td> </tr> </xsl:if> </xsl:for-each> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> --- NEW FILE: update.sh.in --- #! @PATHTOSH@ -f name="woclist" baseuri="http://www-woc.sci.kun.nl/gui/index" htmldir="../../web-docs/gui/index" datadir="." # The default makes all indices except for the pages # translating words XX-XX. Those are done with the # script makechemtrans.pl. all="index.abbrev index.bruto index.nl index.enum index.vnnum \ index.smiles2cas index.cas2smiles" if test "x$1" = "x" then echo "Usage: update.pl xml" echo "Usage: update.pl [web] all" echo "Usage: update.pl [web] <index-name> ..." else if test "x$1" = "xxml" then echo "Creating new $datadir/$name.xml..." $datadir/$name.sh exit fi if test "x$1" = "xweb" then echo "Content-type: text/html" echo "" shift fi if test "x$1" = "xall"; then shift update.sh $all else for index in $* do echo "Parsing $datadir/$name.xml against $datadir/$index.xsl..." xsltproc $datadir/$index.xsl $datadir/$name.xml > $htmldir/$index.html chmod 664 $htmldir/$index.html chgrp wwwwoc $htmldir/$index.html done echo "Done!" fi fi --- NEW FILE: woclist.pl.in --- #! @PATHTOPERL@ use strict; use diagnostics; # Author: Geert Josten # hulp-script gebruikt door wocml.sh my $cmldir="../../data/dadml/physicalprop/cml"; my $infile; my $outfile; if (@ARGV >= 2) { $infile = shift; $outfile = shift; } else { $infile = "woclist.tmp2.xml"; $outfile = "woclist.xml"; } open (INFILE, "$infile"); open (OUTFILE, ">$outfile"); #print eerste regel alvast $_ = <INFILE>; print OUTFILE; while (<INFILE>) { my $file; if (/ITEM.*?CODE=/i) { s/CODE/FILE/i; print OUTFILE; } elsif (/INSERT.*PhysicalProperties.*>(.*)</i) { my @inserts = `awk '/<molecule/,/<\\/molecule/{print " ",\$0}' $cmldir/$1`; foreach my $insert (@inserts) { if ($insert =~ /^(.*Stoichiometry.*>)(.*)(<.*)$/i) { my $pre = $1; my $bruto = $2; my $brutoID = $2; my $post = $3; $bruto =~ s/(\d+)/<sub>$1<\/sub>/ig; print OUTFILE $pre,$bruto,$post,$/; $pre =~ s/Stoichiometry/StoichiometryID/i; $brutoID =~ s/(\d+)/{$1}/ig; while ($brutoID =~ /\{(\d+?)\}/) { my $number = sprintf "%04i", $1; $brutoID =~ s/\{\d+?\}/$number/; } print OUTFILE $pre,$brutoID,$post,$/; } else { print OUTFILE $insert; } } } elsif (/\<\?xml.*\?\>/i) { s/\<\?xml.*\?\>//i; print OUTFILE; } else { print OUTFILE; } } # zoals in Convert.java sub NAMELikeToANCHORLike { # heeft 1 parameter my $param = shift @_; $param =~ s/^\s*(.*?)\s*$/$1/ig; $param =~ s/\ /\_/g; $param =~ s/[,|.|<|>]//g; $param =~ tr/[A-Z]/[a-z]/; return $param; } Index: .cvsignore =================================================================== RCS file: /cvsroot/woc/woc/bin/index/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** .cvsignore 20 Jul 2002 09:34:26 -0000 1.2 --- .cvsignore 20 Jul 2002 14:25:32 -0000 1.3 *************** *** 1,6 **** Makefile Makefile.in woclist.sh woclist.xml makechemtrans.sh ! genindex.*.xsl --- 1,14 ---- Makefile Makefile.in + update.sh woclist.sh + woclist.pl woclist.xml makechemtrans.sh ! index.D*.xsl ! index.E*.xsl ! index.F*.xsl ! index.I*.xsl ! index.L*.xsl ! index.N*.xsl ! genlangxslts.pl Index: Makefile.am =================================================================== RCS file: /cvsroot/woc/woc/bin/index/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.am 20 Jul 2002 09:34:26 -0000 1.1 --- Makefile.am 20 Jul 2002 14:25:32 -0000 1.2 *************** *** 1,11 **** ! bin_SCRIPTS = woclist.sh ! all: woclist.xml ! ! woclist.xml: ! woclist.sh ! ! clean: ! rm genindex.*.xsl ! rm makechemtrans.sh ! rm woclist.xml --- 1,7 ---- ! bin_SCRIPTS = \ ! woclist.sh \ ! woclist.pl \ ! genlangxslts.pl \ ! update.sh ! CLEANFILES = $(bin_SCRIPTS) \ No newline at end of file Index: index.abbrev.xsl =================================================================== RCS file: /cvsroot/woc/woc/bin/index/index.abbrev.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** index.abbrev.xsl 19 Jul 2002 12:19:57 -0000 1.1 --- index.abbrev.xsl 20 Jul 2002 14:25:32 -0000 1.2 *************** *** 1,4 **** <?xml version="1.0"?> ! <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output mode="html"/> --- 1,4 ---- <?xml version="1.0"?> ! <xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output mode="html"/> Index: makechemtrans.sh =================================================================== RCS file: /cvsroot/woc/woc/bin/index/makechemtrans.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** makechemtrans.sh 19 Jul 2002 12:41:15 -0000 1.2 --- makechemtrans.sh 20 Jul 2002 14:25:32 -0000 1.3 *************** *** 1,62 **** ! #!/usr/local/bin/tcsh -f # This script is autogenerated with genlangxslts.pl! Do not edit! ! setenv all "genindex.EN-FR \ ! genindex.EN-ES \ ! genindex.EN-DE \ ! genindex.EN-NL \ ! genindex.EN-IT \ ! genindex.EN-LA \ ! genindex.EN-FY \ ! genindex.FR-EN \ ! genindex.FR-ES \ ! genindex.FR-DE \ ! genindex.FR-NL \ ! genindex.FR-IT \ ! genindex.FR-LA \ ! genindex.FR-FY \ ! genindex.ES-EN \ ! genindex.ES-FR \ ! genindex.ES-DE \ ! genindex.ES-NL \ ! genindex.ES-IT \ ! genindex.ES-LA \ ! genindex.ES-FY \ ! genindex.DE-EN \ ! genindex.DE-FR \ ! genindex.DE-ES \ ! genindex.DE-NL \ ! genindex.DE-IT \ ! genindex.DE-LA \ ! genindex.DE-FY \ ! genindex.NL-EN \ ! genindex.NL-FR \ ! genindex.NL-ES \ ! genindex.NL-DE \ ! genindex.NL-IT \ ! genindex.NL-LA \ ! genindex.NL-FY \ ! genindex.IT-EN \ ! genindex.IT-FR \ ! genindex.IT-ES \ ! genindex.IT-DE \ ! genindex.IT-NL \ ! genindex.IT-LA \ ! genindex.IT-FY \ ! genindex.LA-EN \ ! genindex.LA-FR \ ! genindex.LA-ES \ ! genindex.LA-DE \ ! genindex.LA-NL \ ! genindex.LA-IT \ ! genindex.LA-FY \ ! genindex.FY-EN \ ! genindex.FY-FR \ ! genindex.FY-ES \ ! genindex.FY-DE \ ! genindex.FY-NL \ ! genindex.FY-IT \ ! genindex.FY-LA \ " ! update.pl noxml $all --- 1,62 ---- ! #! /usr/bin/sh # This script is autogenerated with genlangxslts.pl! Do not edit! ! all="index.EN-FR \ ! index.EN-ES \ ! index.EN-DE \ ! index.EN-NL \ ! index.EN-IT \ ! index.EN-LA \ ! index.EN-FY \ ! index.FR-EN \ ! index.FR-ES \ ! index.FR-DE \ ! index.FR-NL \ ! index.FR-IT \ ! index.FR-LA \ ! index.FR-FY \ ! index.ES-EN \ ! index.ES-FR \ ! index.ES-DE \ ! index.ES-NL \ ! index.ES-IT \ ! index.ES-LA \ ! index.ES-FY \ ! index.DE-EN \ ! index.DE-FR \ ! index.DE-ES \ ! index.DE-NL \ ! index.DE-IT \ ! index.DE-LA \ ! index.DE-FY \ ! index.NL-EN \ ! index.NL-FR \ ! index.NL-ES \ ! index.NL-DE \ ! index.NL-IT \ ! index.NL-LA \ ! index.NL-FY \ ! index.IT-EN \ ! index.IT-FR \ ! index.IT-ES \ ! index.IT-DE \ ! index.IT-NL \ ! index.IT-LA \ ! index.IT-FY \ ! index.LA-EN \ ! index.LA-FR \ ! index.LA-ES \ ! index.LA-DE \ ! index.LA-NL \ ! index.LA-IT \ ! index.LA-FY \ ! index.FY-EN \ ! index.FY-FR \ ! index.FY-ES \ ! index.FY-DE \ ! index.FY-NL \ ! index.FY-IT \ ! index.FY-LA \ " ! update.sh $all Index: templindex.XX-XX.xsl =================================================================== RCS file: /cvsroot/woc/woc/bin/index/templindex.XX-XX.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** templindex.XX-XX.xsl 19 Jul 2002 12:19:57 -0000 1.1 --- templindex.XX-XX.xsl 20 Jul 2002 14:25:32 -0000 1.2 *************** *** 1,11 **** <?xml version="1.0"?> ! <xsl:stylesheet xsl:version="1.0" ! xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> ! <base href="http://www.sci.kun.nl/woc/"/> ! <link rel="stylesheet" href="http://www.sci.kun.nl/woc/gui/styles/woc.css" type="text/css"/> </head> <body class="main"> --- 1,12 ---- <?xml version="1.0"?> ! <xsl:stylesheet xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ! ! <!-- This stylesheet is autogenerated with genlangxslts.pl! Do not edit! --> <xsl:template match="/"> <html> <head> ! <base href="http://www-woc.sci.kun.nl/"/> ! <link rel="stylesheet" href="http://www-woc.sci.kun.nl/gui/styles/woc.css" type="text/css"/> </head> <body class="main"> *************** *** 26,35 **** <xsl:sort select="LANG[@ID='#FROM#']"/> <xsl:for-each select="LANG[@ID='#FROM#']"> ! <xsl:if test="../LANG[@ID='#TO#']"> ! <tr> ! <td class="main"><xsl:value-of select="."/></td> ! <td class="main"><a href="http://www.sci.kun.nl/woc/gui/items/{../../../@FILE}.shtml"><xsl:value-of select="../LANG[@ID='#TO#']"/></a></td> ! </tr> ! </xsl:if> </xsl:for-each> </xsl:for-each> --- 27,36 ---- <xsl:sort select="LANG[@ID='#FROM#']"/> <xsl:for-each select="LANG[@ID='#FROM#']"> ! <xsl:if test="../LANG[@ID='#TO#']"> ! <tr> ! <td class="main"><xsl:value-of select="."/></td> ! <td class="main"><a href="http://www-woc.sci.kun.nl/gui/items/{../../../@FILE}.shtml"><xsl:value-of select="../LANG[@ID='#TO#']"/></a></td> ! </tr> ! </xsl:if> </xsl:for-each> </xsl:for-each> Index: woclist.sh.in =================================================================== RCS file: /cvsroot/woc/woc/bin/index/woclist.sh.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** woclist.sh.in 20 Jul 2002 09:34:26 -0000 1.1 --- woclist.sh.in 20 Jul 2002 14:25:32 -0000 1.2 *************** *** 11,18 **** # cmldir is in perl-stukje gedefinieerd ! cat `find $WMLDIR -name "*.xml"` > $NAME$TEMP ! echo '<?xml version="1.0" encoding="ISO-8859-1"?>' > ! $NAME$TEMP2 ! echo '<\!DOCTYPE ITEM SYSTEM "../../lib/xml/dtd/'$NAME'.dtd">' >> $NAME$TEMP2 echo '<'$NAME' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' >> $NAME$TEMP2 echo ' xmlns:import="http://www.sci.kun.nl/woc/import"' >> $NAME$TEMP2 --- 11,18 ---- # cmldir is in perl-stukje gedefinieerd ! cat `find $WMLDIR -name "*.xml" | grep -v templates` > $NAME$TEMP ! echo '<?xml version="1.0" encoding="ISO-8859-1"?>' > $NAME$TEMP2 ! echo '<!DOCTYPE ITEM SYSTEM "../../lib/xml/dtd/'$NAME'.dtd">' >> $NAME$TEMP2 echo '<'$NAME' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' >> $NAME$TEMP2 echo ' xmlns:import="http://www.sci.kun.nl/woc/import"' >> $NAME$TEMP2 --- genlangxslts.pl DELETED --- --- update.pl DELETED --- --- woclist.pl DELETED --- |