summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/xindy/xindy.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/xindy/xindy.pl')
-rwxr-xr-xMaster/texmf-dist/scripts/xindy/xindy.pl82
1 files changed, 61 insertions, 21 deletions
diff --git a/Master/texmf-dist/scripts/xindy/xindy.pl b/Master/texmf-dist/scripts/xindy/xindy.pl
index a1fecf65a29..80eaafe6d59 100755
--- a/Master/texmf-dist/scripts/xindy/xindy.pl
+++ b/Master/texmf-dist/scripts/xindy/xindy.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: xindy.pl,v 1.16 2010/05/10 23:39:24 jschrod Exp $
+# $Id: xindy.pl,v 1.18 2011/01/18 22:18:29 jschrod Exp $
#------------------------------------------------------------
# (history at end)
@@ -99,9 +99,12 @@ The index is sorted according to the rules of language I<lang>. These
rules are encoded in a xindy module created by I<make-rules>.
If no input encoding is specified via C<--codepage>, a xindy module
-for that language is searched with a latin, a cp, an iso, or ascii
+for that language is searched with a latin, a cp, an iso, ascii, or utf8
encoding, in that order.
+Language modules are either placed in the F<lang> or in the
+F<contrib/lang> sub-directory of the modules base directory.
+
=item C<--codepage> I<enc> / B<-C> I<enc>
The raw input is in input encoding I<enc>. This information is used to
@@ -266,6 +269,22 @@ should please contact the author.
=item *
+If you have an index rage and a location attribute, e.g.,
+C<\index{key\(attr}> starts the range, one needs (1) to specify that
+attribute in the range closing entry as well (i.e., as
+C<\index{key\)attr}>) and (2) one needs to declare the index attribute
+in an B<xindy> style file.
+
+MakeIndex will output the markup C<\attr{page1--page2}> for such a
+construct. This is not possible to achieve in B<xindy>, output will be
+C<\attrMarkup{page1}--\attrMarkup{page2}>. (This is actually
+considered a bug, but not a high priority one.)
+
+The difference between MakeIndex page number tags and B<xindy>
+location attributes was already explained in the previous item.
+
+=item *
+
The MakeIndex compatibility definitions support only the default raw
index syntax and markup definition. It is not possible to configure
raw index parsing or use a MakeIndex style file to describe output
@@ -322,7 +341,7 @@ GNU General Public License for more details.
use strict;
use English qw(-no_match_vars);
-our $VERSION = sprintf "%d.%02d", q$Revision: 1.16 $ =~ /: (\d+)\.(\d+)/ ;
+our $VERSION = sprintf "%d.%02d", q$Revision: 1.18 $ =~ /: (\d+)\.(\d+)/ ;
# Used modules.
@@ -370,25 +389,31 @@ $TMPDIR = ".";
# FIXME: In standalone installations, modules are still placed in lib
# directory. This is not conformant to FHS.
-if ( $is_TL ) { # TeX Live
+if ( $is_TL ) { # TeX Live and MikTeX
$modules_dir = Cwd::realpath("$cmd_dir/../../xindy/modules");
die "$cmd: Cannot locate xindy modules directory" unless -d $modules_dir;
if ( $is_w32 ) {
- $cmd_dir = "$cmd_dir/../../../bin/win32";
+ if ( -d "$cmd_dir/../../../bin/win32" ) { # TeX Live
+ $cmd_dir = "$cmd_dir/../../../bin/win32";
+ } elsif ( -d "$cmd_dir/../../miktex/bin" ) { # MikTeX
+ $cmd_dir = "$cmd_dir/../../miktex/bin";
+ } else {
+ die "$cmd: Cannot locate bin directory";
+ }
} else {
die "$cmd: not a symlink as required for TeX Live" unless -l $0;
# Follow symlinks and determine $cmd_dir such that
# $cmd_dir/xindy -> $r0 = XINDY_SCRIPTDIR/xindy.pl
- #
- # FIXME: What's this code good for? Cwd::realpath() already
- # resolves all symbolic links; this just recomputes that
- # information manually! It's from Peter, check with him.
+ # I.e., it determines the directory with the last symbolic link; the
+ # one that points to a real file. That's the directory with the binary
+ # files (Lisp executable and memory file).
$real_cmd = $0;
while (-l $real_cmd) {
$cmd_dir = dirname($real_cmd);
$real_cmd = readlink($real_cmd);
+ # \ directory separator may happen on Cygwin.
$real_cmd = "$cmd_dir/$real_cmd" unless $real_cmd =~ m,^[\\/],; # relative link
}
}
@@ -438,7 +463,8 @@ sub usage ( ;$ )
{
my $exit_code = shift;
$exit_code += 0; # turn undef into 0
- print STDERR <<_EOT_
+ my $out = ( $exit_code ? *STDERR : *STDOUT );
+ print $out <<_EOT_
usage: $cmd [-V?h] [-qv] [-d magic] [-o outfile.ind] [-t log] \\
[-L lang] [-C codepage] [-M module] [-I input] \\
@@ -702,8 +728,6 @@ sub xindy_expression () {
# FIXME: I didn't see all languages. What's on with gypsy and
# hausa?
if ( $language ) {
- my $ld = "$modules_dir/lang";
- my $variant;
# If there is no language directory, this might be a variant.
# Language names and variants are separated by hyphens. The
# variant name "din" is an abbreviation for "din5007". The
@@ -711,20 +735,29 @@ sub xindy_expression () {
# name.
#
# FIXME: Or is "iso" the variant "translit"?!
- if ( ! -d "$ld/$language" ) {
- $language =~ /^([^-]*)-(.*)/ ; # language name ends with 1st hyphen
- if ( $2 && -d "$ld/$1" ) { # $2 is not set if the regex didn't match
- $language = $1;
- $variant = "$2-" unless ( $2 eq 'iso' );
- $variant eq 'din-' and $variant = 'din5007-';
+ my @lang_base_dirs = ("$modules_dir/contrib/lang", "$modules_dir/lang");
+ my ($lang_dir, $variant);
+ foreach my $ld ( @lang_base_dirs ) {
+ if ( -d "$ld/$language" ) {
+ $lang_dir = "$ld/$language";
+ last;
+ } else {
+ $language =~ /^([^-]*)-(.*)/ ; # language name ends with 1st hyphen
+ if ( $2 && -d "$ld/$1" ) { # $2 is not set if the regex didn't match
+ $language = $1;
+ $lang_dir = "$ld/$language";
+ $variant = "$2-" unless ( $2 eq 'iso' );
+ $variant eq 'din-' and $variant = 'din5007-';
+ last;
+ }
}
}
# Let's guess the codepage. We take any that starts with
- # "latin", "cp", "iso8859", or "ascii".
- @codepages = qw(latin cp iso8859 ascii) unless @codepages;
+ # "latin", "cp", "iso8859", "ascii", or "utf8".
+ @codepages = qw(latin cp iso8859 ascii utf8) unless @codepages;
my @styles;
foreach my $cp ( @codepages ) {
- @styles = glob("$ld/$language/$variant$cp*-lang.xdy");
+ @styles = glob("$lang_dir/$variant$cp*-lang.xdy");
last if @styles;
}
unless ( @styles ) {
@@ -867,6 +900,13 @@ sub quotify ( $ ) {
#======================================================================
#
# $Log: xindy.pl,v $
+# Revision 1.18 2011/01/18 22:18:29 jschrod
+# Document the range raw markup incompatibility with MakeIndex.
+# (Bug ticket 998541)
+#
+# Revision 1.17 2010/08/12 00:16:01 jschrod
+# Output help message on stdout if there's no error.
+#
# Revision 1.16 2010/05/10 23:39:24 jschrod
# Incorporate TeX-Live patches from Vladimir Volovich and Peter
# Breitenlohner: Support for TL installation scheme, support for Mac OS