summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/esindex/esindex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/esindex/esindex.sty')
-rw-r--r--macros/latex/contrib/esindex/esindex.sty57
1 files changed, 49 insertions, 8 deletions
diff --git a/macros/latex/contrib/esindex/esindex.sty b/macros/latex/contrib/esindex/esindex.sty
index 4594874db4..a63bdba6eb 100644
--- a/macros/latex/contrib/esindex/esindex.sty
+++ b/macros/latex/contrib/esindex/esindex.sty
@@ -7,7 +7,7 @@
% Repository: https://github.com/jbezos/esindex
%
-\ProvidesPackage{esindex}[2019/09/30 v1.6 Spanish indexes (and more)]
+\ProvidesPackage{esindex}[2019/10/10 v1.7 Spanish indexes (and more)]
\def\esx@level{`\!}
\def\esx@actual{`\@}
@@ -68,6 +68,8 @@
\catcode`\"=13
\catcode`\~=13
+\catcode`\^^A=12
+
\gdef\esindex#1#{\esx@index{#1}}
\lowercase{
@@ -90,7 +92,21 @@
\gdef\esx@bar@eat#1|{\def\esx@a{|#1}}
}
-\gdef\esindexexpandkey{\protected@edef\esindexkey{\esindexkey}}
+\gdef\esindexexpandkey{%
+ \protected@edef\esindexkey{\esindexkey}}
+\gdef\esindexexpandsubkey{%
+ \ifx\esindexsubkey\relax\else
+ \protected@edef\esindexsubkey{\esindexsubkey}%
+ \fi}
+\gdef\esindexexpandsubsubkey{%
+ \ifx\esindexsubsubkey\relax\else
+ \protected@edef\esindexsubsubkey{\esindexsubsubkey}%
+ \fi}
+
+\gdef\esindexexpandkeys{%
+ \esindexexpandkey
+ \esindexexpandsubkey
+ \esindexexpandsubsubkey}
% The following is called for every ! level, much like a loop. #1 is
% the current level.
@@ -111,8 +127,16 @@
% Execute \everyesindex and apply accents, so that \'a becomes a, and
% redefinitions in \everyesindex are also "applied"
\the\everyesindex
- \esindexexpandkey
+ \esindexexpandkeys
\esx@spanishreplacements
+ \protected@edef\esindexkey{%
+ \esindexkey
+ \ifx\esindexsubkey\relax\else
+ ^^A\esindexsubkey
+ \fi
+ \ifx\esindexsubsubkey\relax\else
+ ^^A\esindexsubsubkey
+ \fi}%
\@temptokena\expandafter{\esindexkey}%
% Key now in \@temptokena
% Particles, with \ignorewords. \esx@remwords works on \@temptokena
@@ -235,11 +259,28 @@
\expandafter\esx@replace@aux#1#2\esx@nil#2%
\edef#1{\the\toks@}}
-\def\esindexreplace#1#2{\esx@replace\esindexkey{#1}{#2}}
+\let\esindexsubkey\relax
+\let\esindexsubsubkey\relax
+
+\newcommand\esindexreplace[2]{%
+ \esx@replace\esindexkey{#1}{#2}}
+\newcommand\esindexreplacesub[3]{%
+ \ifx\esindexsubkey\relax
+ \let\esindexsubkey\esindexkey
+ \fi
+ \esindexreplace{#1}{#2}%
+ \esx@replace\esindexsubkey{#1}{#3}}
+\newcommand\esindexreplacesubsub[4]{%
+ \ifx\esindexsubsubkey\relax
+ \let\esindexsubsubkey\esindexkey
+ \fi
+ \esindexreplacesub{#1}{#2}{#3}%
+ \esx@replace\esindexsubsubkey{#1}{#4}}
%-------------------------
\let\esx@spanishreplacements\relax
+\let\esx@@spanishreplacements\relax
\ifesx@spanish
@@ -280,14 +321,14 @@
\ifx\XeTeXinterchartoks\@undefined
\catcode`\^^ff=12
\xdef\esindexlastchar{^^ff}
- \else
+ \else % Hats in xetex seem buggy. Limit to 4.
\catcode`\^^^^ffff=12
\xdef\esindexlastchar{^^^^ffff}
\global\let\esx@spanishreplacements\esx@@spanishreplacements
\fi
- \else
- \catcode`\^^^^ffff=12
- \xdef\esindexlastchar{^^^^ffff}
+ \else
+ \catcode`\^^^^^^10ffff=12
+ \xdef\esindexlastchar{^^^^^^10ffff}
\global\let\esx@spanishreplacements\esx@@spanishreplacements
\fi
\endgroup