summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/glossaries
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-09-23 20:14:27 +0000
committerKarl Berry <karl@freefriends.org>2021-09-23 20:14:27 +0000
commite5b21ac8f2058cbf69a1444fd7075f769037151a (patch)
treea4f3c6dc09f7d6b231addafe10e9c87ef82b7201 /Master/texmf-dist/scripts/glossaries
parenta0a43165d11c155e15abb9051332c8b4e5576db6 (diff)
glossaries (23sep21)
git-svn-id: svn://tug.org/texlive/trunk@60591 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/glossaries')
-rwxr-xr-xMaster/texmf-dist/scripts/glossaries/makeglossaries53
-rwxr-xr-xMaster/texmf-dist/scripts/glossaries/makeglossaries-lite.lua55
2 files changed, 69 insertions, 39 deletions
diff --git a/Master/texmf-dist/scripts/glossaries/makeglossaries b/Master/texmf-dist/scripts/glossaries/makeglossaries
index fe1e1248d9b..2d60ff66887 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 : 4.45
+# Version : 4.47
# Description: simple Perl script that calls makeindex or xindy.
# Intended for use with "glossaries.sty" (saves having to remember
# all the various switches)
@@ -31,25 +31,15 @@
# glossaries-babel.sty, glossaries-polyglossia.sty, glossaries.perl.
# Also makeglossaries and makeglossaries-lite.lua.
-my $version="4.45 (2020-01-18)";
+my $version="4.47 (2021-09-20)";
# History:
-# v4.43:
-# * No change.
-# v4.41:
-# * No change.
-# v4.40:
-# * No change.
-# v4.39:
-# * No change.
-# v4.38:
-# * No change.
-# v4.37:
-# * No change.
-# v4.36:
-# * No change.
-# v4.35:
-# * No change.
+# v4.47:
+# * Added hybrid instructions if record option detected but not
+# \makeglossaries
+# * Added quote_if_spaced subroutine
+# v4.35 - v4.46:
+# * No change. (Version number updated in line with glossaries.sty)
# v4.34:
# * Added check for \glsxtr@resource
# v4.33:
@@ -350,9 +340,12 @@ unless ($istfile)
{
if ($foundbib2glsresource)
{
+# v4.47 added extra hybrid instructions
die "Found \\glsxtr\@resource in '$name.aux',\n",
"but not found \\\@istfilename.\n",
- "You need to run bib2gls not makeglossaries.\n";
+ "You need to run bib2gls not makeglossaries.\n",
+ "If you have used record=alsoindex or record=hybrid\n",
+ "then add \\makeglossaries to your preamble.\n";
}
else
{
@@ -818,6 +811,21 @@ sub scan_aux{
}
}
+# v4.47 new
+# Issue #129 was specifically about the Lua script but it's
+# likely the same problem would occur with this Perl script given
+# the same version of cmd.exe
+sub quote_if_spaced{
+ my ($str) = @_;
+
+ if ($str=~/ /)
+ {
+ $str = "\"$str\"";
+ }
+
+ $str;
+}
+
# v2.01 new subroutine run_app added
sub run_app{
my($appname, $appargs, $trans, $quiet, $dontexec) = @_;
@@ -833,9 +841,12 @@ sub run_app{
return if ($dontexec);
+ # v4.47
+ my $cmdstr = &quote_if_spaced($appname) . " $appargs";
+
# v2.11 added double-quotes around $appname
# v2.14 added -k switch
- if (not $opt_k and open (STATUS, "\"$appname\" $appargs 2>&1 |"))
+ if (not $opt_k and open (STATUS, "$cmdstr 2>&1 |"))
{
while (<STATUS>)
{
@@ -861,7 +872,7 @@ sub run_app{
"Retrying without redirection.\n" unless ($quiet or $opt_Q);
}
- $status = `\"$appname\" $appargs`;
+ $status = `$cmdstr`;
$log = $status;
diff --git a/Master/texmf-dist/scripts/glossaries/makeglossaries-lite.lua b/Master/texmf-dist/scripts/glossaries/makeglossaries-lite.lua
index 5e2272ff094..bee21d2cfce 100755
--- a/Master/texmf-dist/scripts/glossaries/makeglossaries-lite.lua
+++ b/Master/texmf-dist/scripts/glossaries/makeglossaries-lite.lua
@@ -36,13 +36,13 @@
Also makeglossaries and makeglossaries-lite.lua.
History:
- * 4.45:
- - no change.
- * 4.44:
- - no change.
- * 4.41:
- - no change.
- * 4.40:
+ * 4.47:
+ - Added hybrid instructions if record option detected but not \makeglossaries
+ - Added extra info to error message on -d
+ - Fixed bug #183 that occurs when \@istfilename is missing
+ - Only add double-quotes if text contains any spaces which
+ may help address issue #129
+ * 4.40 - 4.46:
- no change.
* 4.39:
- corrected script name in version and help messages
@@ -68,7 +68,7 @@
- changed first line from lua to texlua
--]]
-thisversion = "4.45 (2020-01-18)"
+thisversion = "4.47 (2021-09-20)"
quiet = false
dryrun = false
@@ -163,6 +163,17 @@ function dorun(name, glg, gls, glo, language, codepage)
end
+-- v4.47 only add double-quotes if text contains any spaces
+function quote_if_spaced(str)
+
+ if string.find(str, " ") then
+ str = '"' .. str .. '"'
+ end
+
+ return str;
+
+end
+
function doxindy(name, glg, gls, glo, language, codepage)
if codepage == nil
@@ -170,14 +181,14 @@ function doxindy(name, glg, gls, glo, language, codepage)
codepage = "utf8"
end
- cmd = string.format('"%s" -I xindy -L %s -C %s -M "%s" -t "%s" -o "%s"',
- xindyexec, language, codepage, styfile, glg, gls)
+ cmd = string.format('%s -I xindy -L %s -C %s -M %s -t %s -o %s',
+ quote_if_spaced(xindyexec), language, codepage, quote_if_spaced(styfile), quote_if_spaced(glg), quote_if_spaced(gls))
if letterorder then cmd = string.format('%s -M ord/letorder', cmd) end
if quiet then cmd = string.format('%s -q', cmd) end
- cmd = string.format('%s "%s"', cmd, glo)
+ cmd = string.format('%s %s', cmd, quote_if_spaced(glo))
if dryrun then
@@ -194,7 +205,7 @@ end
function domakeindex(name, glg, gls, glo)
- cmd = string.format('"%s"', makeindex_m)
+ cmd = quote_if_spaced(makeindex_m)
if makeindex_c then cmd = cmd .. " -c" end
@@ -206,19 +217,19 @@ function domakeindex(name, glg, gls, glo)
if quiet then cmd = cmd .. " -q" end
- if glg ~= nil then cmd = string.format('%s -t "%s"', cmd, glg) end
+ if glg ~= nil then cmd = string.format('%s -t %s', cmd, quote_if_spaced(glg)) end
- if gls ~= nil then cmd = string.format('%s -o "%s"', cmd, gls) end
+ if gls ~= nil then cmd = string.format('%s -o %s', cmd, quote_if_spaced(gls)) end
if makeindex_p ~= nil then
cmd = string.format("%s -p %s", cmd, makeindex_p)
end
if styfile ~= nil then
- cmd = string.format('%s -s "%s"', cmd, styfile)
+ cmd = string.format('%s -s %s', cmd, quote_if_spaced(styfile))
end
- cmd = string.format('%s "%s"', cmd, glo)
+ cmd = string.format('%s %s', cmd, quote_if_spaced(glo))
if dryrun then
print(cmd)
@@ -275,7 +286,7 @@ while i <= #arg do
elseif arg[i] == "-d"
then
error(string.format(
- "The '%s' option isn't available for this light-weight version.\nYou will need to use the Perl version instead.",
+ "The '%s' option isn't available for this light-weight version. \n(Lua doesn't natively provide a function to change directory.) \nYou will need to use the Perl version instead \nor just change directory before running this script.",
arg[i]))
-- Xindy Options
@@ -382,15 +393,23 @@ then
-- v4.36: corrected check for double-quotes
styfile = string.match(aux, "\\@istfilename{([^}]*)}")
- styfile = string.gsub(styfile, "\"", "");
+
+-- v4.47: added check for null styfile (missing \@istfilename)
+ if styfile ~= nil
+ then
+ styfile = string.gsub(styfile, "\"", "");
+ end
if styfile == nil
then
if isbib2gls
then
+-- v4.47 added extra hybrid instructions
error([[
No \@istfilename found but found \glsxtr@resource.
You need to run bib2gls not makeglossaries-lite.
+If you have used record=alsoindex or record=hybrid
+then add \makeglossaries to your preamble.
]])
else
error([[