summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/glossaries
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-06-01 23:39:05 +0000
committerKarl Berry <karl@freefriends.org>2009-06-01 23:39:05 +0000
commit0c13c2fa41ec19c3844414c339528abe82a9cd79 (patch)
treeef475ebee484639f9162b6cb4fc503ff7a19b744 /Master/texmf-dist/scripts/glossaries
parenta8d496072399303044632adc3815973fe69ff748 (diff)
glossaries 2.01 (1jun09)
git-svn-id: svn://tug.org/texlive/trunk@13568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/glossaries')
-rwxr-xr-xMaster/texmf-dist/scripts/glossaries/makeglossaries109
1 files changed, 73 insertions, 36 deletions
diff --git a/Master/texmf-dist/scripts/glossaries/makeglossaries b/Master/texmf-dist/scripts/glossaries/makeglossaries
index 8de4584b574..609409dca74 100755
--- a/Master/texmf-dist/scripts/glossaries/makeglossaries
+++ b/Master/texmf-dist/scripts/glossaries/makeglossaries
@@ -2,7 +2,7 @@
# File : makeglossaries
# Author : Nicola Talbot
-# Version : 1.5 (2008/12/26)
+# Version : 1.6 (2009/05/24)
# Description: simple Perl script that calls makeindex or xindy.
# Intended for use with "glossaries.sty" (saves having to remember
# all the various switches)
@@ -28,6 +28,12 @@
# Also makeglossaries and makeglossaries.
#
# History:
+# v1.6 (2009-05-24) :
+# * main glossary no longer automatically added
+# (only added if information in aux file)
+# * if file extension is specified, check added to ensure it
+# corresponds to a known glossary extension.
+# * added file existance test and file empty test
# v1.5 (2008-12-26) :
# * added support for xindy
# * picks up ordering information from aux file
@@ -68,8 +74,11 @@ unless ($#ARGV == 0)
# define known extensions
+# v1.6: removed adding main glossary here as there's no guarantee
+# that it's been used. If it has been used, the information will
+# be picked up later in the aux file
my %exttype = (
- main => {in=>'glo', out=>'gls', 'log'=>'glg'},
+# main => {in=>'glo', out=>'gls', 'log'=>'glg'},
);
# v1.5 define require languages for xindy
@@ -110,8 +119,7 @@ if (open AUXFILE, "$name.aux")
{
while (<AUXFILE>)
{
- if (m/\\\@newglossary\s*\{(.*)\}{(.*)}{(.*)}{(.*)}/
- and ($1 ne 'main'))
+ if (m/\\\@newglossary\s*\{(.*)\}{(.*)}{(.*)}{(.*)}/)
{
$exttype{$1}{'log'} = $2;
$exttype{$1}{'out'} = $3;
@@ -249,7 +257,9 @@ if ($ext ne '')
{
# an extension has been specified, so only process
# the specified file
- my %thistype = %{$exttype{'main'}}; #default
+
+ # v1.6 %thistype is no longer given a default value
+ my %thistype;
my $thislang = "";
my $thiscodepage = "";
@@ -268,6 +278,16 @@ if ($ext ne '')
}
}
+ # v1.6 If %thistype hasn't been defined, then the given
+ # extension doesn't correspond to any known glossary type
+
+ unless (defined %thistype)
+ {
+ die "The file extension '$ext' doesn't correspond to any\n",
+ "known glossary extension. Try running makeglossaries\n",
+ "without an extension, e.g. makeglossaries \"$name\".\n";
+ }
+
my $outfile;
if ($opt_o eq "")
@@ -311,45 +331,62 @@ else
my $inputfile = "$name.$thistype{in}";
- if (-r $inputfile)
+ # v1.6 added file existance test
+ unless (-e $inputfile)
{
- my $outfile;
+ print STDERR "File '$inputfile' doesn't exist.\n",
+ "*** Skipping glossary '$type'. ***\n";
+ next;
+ }
- if ($opt_o eq "")
- {
- $outfile = "$name.$thistype{out}";
- }
- else
- {
- $outfile = $opt_o;
- }
+ unless (-r $inputfile)
+ {
+ print STDERR "No read access for '$inputfile' $!\n",
+ "*** Skipping glossary '$type'. ***\n";
+ next;
+ }
- my $transcript;
+ # v1.6 added file empty test
+ if (-z $inputfile)
+ {
+ print STDERR "File '$inputfile' is empty.\n",
+ "Have you used any entries defined in glossary '$type'?\n",
+ "*** Skipping glossary '$type'. ***\n";
+ next;
+ }
- if ($opt_t eq "")
- {
- $transcript = "$name.$thistype{'log'}";
- }
- else
- {
- $transcript = $opt_t;
- }
+ my $outfile;
- if ($usexindy)
- {
- &xindy($inputfile,$outfile,$transcript,$istfile,
- $language{$type},$codepage{$type},
- $xdyopts,$opt_q,$opt_n);
- }
- else
- {
- &makeindex($inputfile,$outfile,$transcript,
- $istfile,$mkidxopts,$opt_q,$opt_n);
- }
+ if ($opt_o eq "")
+ {
+ $outfile = "$name.$thistype{out}";
+ }
+ else
+ {
+ $outfile = $opt_o;
+ }
+
+ my $transcript;
+
+ if ($opt_t eq "")
+ {
+ $transcript = "$name.$thistype{'log'}";
+ }
+ else
+ {
+ $transcript = $opt_t;
+ }
+
+ if ($usexindy)
+ {
+ &xindy($inputfile,$outfile,$transcript,$istfile,
+ $language{$type},$codepage{$type},
+ $xdyopts,$opt_q,$opt_n);
}
else
{
- print STDERR "No read access for '$inputfile': $!\n";
+ &makeindex($inputfile,$outfile,$transcript,
+ $istfile,$mkidxopts,$opt_q,$opt_n);
}
}
}