texlive[67651] trunk: xindex (16jul23)

commits+karl at tug.org commits+karl at tug.org
Sun Jul 16 21:44:44 CEST 2023


Revision: 67651
          http://tug.org/svn/texlive?view=revision&revision=67651
Author:   karl
Date:     2023-07-16 21:44:44 +0200 (Sun, 16 Jul 2023)
Log Message:
-----------
xindex (16jul23)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua
    trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG
    trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf
    trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex
    trunk/Master/texmf-dist/scripts/xindex/xindex.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua
    trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua

Modified: trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
         xindex = xindex or { }
- local version = 0.51
+ local version = 0.53
 xindex.version = version
 --xindex.self = "xindex"
 
@@ -43,21 +43,21 @@
     -q,--quiet
     -h,--help
     -v...          Verbosity level; can be -v, -vv, -vvv
+    -V,--version
+    -a,--no_casesensitive
+    -b,--no_labels
     -c,--config (default cfg)
     -e,--escapechar (default ")
     -f,--fix_hyperref
-    -n,--noheadings 
-    -a,--no_casesensitive
-    -b,--no_labels
+    -g,--no_pagenumber
     -i,--ignoreSpace
-    -o,--output (default "")
     -k,--checklang               
     -l,--language (default en)   
-    -g,--no_pagenumber
+    -n,--noheadings 
+    -o,--output (default "")
     -p,--prefix (default L)
+    -s,--use_stdin
     -u,--use_UCA 
-    -s,--use_stdin
-    -V,--version
     <files...> (default stdin) .idx file(s)
 ]]
 
@@ -223,18 +223,18 @@
 alphabet_upper_map = CreateCharListMap(alphabet_upper)
 
 esc_char = args.escapechar
+esc_char2 = esc_char..esc_char  
 writeLog(2,"Escapechar = "..esc_char.."\n",1)
 escape_chars = { -- by default " is the escape char
-  {esc_char..'"', '//escapedquote//',     '"'    },
-  {esc_char..'@', '//escapedat//',        '@'    },
-  {esc_char..'|', '//escapedvert//',      '|'    },
-  {esc_char..'!', '//escapedexcl//',      '!'    }
---  {esc_char..'%(', '//escapedparenleft//', '('    },  -- ( must beescaped
---  {esc_char..'%)', '//escapedparenright//',')'    }   -- )  "      "
+  {esc_char2,     '//escaped2//', esc_char    },
+  {esc_char..'@', '//escapedat//',    '@'    },
+  {esc_char..'|', '//escapedvert//',  '|'    },
+  {esc_char..'!', '//escapedexcl//',  '!'    },
+  {'',            '\\textbar',        '|'    },  
+  {'',            '\\braceLeft',      '{'    },  
+  {'',            '\\braceRight',     '}'    }
 }
 
--- esc_char..'%( is not needed because it can only appear after |
-
 outFile = io.open(outfilename,"w+")
 
 check_language = args["checklang"]

Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG	2023-07-16 19:44:44 UTC (rev 67651)
@@ -1,3 +1,6 @@
+0.53  2023-07-16 - added function literize to escape special lua characters
+                   for gsub and xindex's escape character
+0.52  2023-07-12 - fix for special escape characters
 0.51  2023-07-10 - change \parenLeft|Right to \braceLeft|Right
                  - added option for a fix for hyperref if using "|
 0.50  2023-07-08 - fix for introduced bug 

Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex	2023-07-16 19:44:44 UTC (rev 67651)
@@ -37,7 +37,7 @@
  \gdef\DoubleperCent{%%}
 }
 
-\usepackage{xcolor,fancyvrb,varioref}
+\usepackage{xcolor,fancyvrb,varioref,awesomebox}
 \usepackage{xltabular}
 \usepackage{hvlogos} % for Wikipedia W
 \usepackage{listings}
@@ -81,7 +81,7 @@
 \def\setVersion#1{\setVVersion#1!!}
 \def\setVVersion#1=#2!!{\def\xIndexVersion{#2}} 
 
-\setVersion{version = 0.51}%  can be automatically changed by perl
+\setVersion{version = 0.53}%  can be automatically changed by perl
 
 
 
@@ -95,7 +95,8 @@
 \tableofcontents
 
 \clearpage
-\bgroup\raggedright
+\begin{noteblock}
+\raggedright
 Thanks to: \\
 Mark Baudoin;
 Denis Bitouzé;
@@ -104,7 +105,7 @@
 Gonzalo Pesquero Serrano;
 Michal Hoftich;
 Mykel Kochenderfer;
-Alexey Kuznetzov;
+Alexey Kuznetsov;
 Frank Mittelbach;
 Peter Müller;
 Heiko Oberdiek;
@@ -114,12 +115,12 @@
 Martin Sievers;
 Simon Spiegel;
 Jürgen Spitzmüller;
-\egroup
+\end{noteblock}
 \clearpage
 
 \section{Introduction}
 The Lua program
-\XI is a  \Index{unicode} aware program for creating an index file from an \Lext{idx} source
+\XI is a  \Index{unicode} aware program for creating an index (\Lext{ind}) file from an \Lext{idx} source
 file. It is completely compatible to the current \Lprog{makeindex} program, but can handle
 \Index{UTF-8}, 16, 32, and 64. The \LaTeX\ package \Lpack{xindex} is a package which provides
 a \LaTeX\ command which writes additional text into the index file. This text (comments and/or macros)
@@ -173,30 +174,32 @@
     [-q,--quiet ]
     [-h,--help ]
     [-v ]                                 verbose
+    [-V,--version ]
+    [-a,--no_casesensitive ]              default is false
+    [-b,--no_labels ]                     default is false
     [-c,--config ]                        default is cfg
     [-e,--escapechar ]                    default is " 
-    [-a, --no_casesensitive ]             default is false
-    [-b,--no_labels ]                     default is false
-    [-n,--noheadings ]                    default is false
+    [-f,--fix_hyperref ]                  default is false
+    [-g,--no_pagenumber]                  default is false
     [-i,--ignoreSpace ]                   default is false
-    [-o,--output ]                        default is <input>.ind
     [-k,--checklang ]                     default ist false 
     [-l,--language ]                      default is en 
-    [-g,--no_pagenumber]                  default is false
+    [-n,--noheadings ]                    default is false
+    [-o,--output ]                        default is <input>.ind
     [-p,--prefix]                         default L
-    [-u,--use_UCA ]                       default is false
     [-s,--use_stdin ]                     default is false
-    [-V,--version ]
+    [-u,--use_UCA ]                       default is false    
     <files...> (default stdin) file(s)[.idx]   one or more files
 \end{verbatim}
 
 For example:
 
-\begin{verbatim}
-xindex -q -l fr -b myDoc 
-xindex -l de -c DIN2 demo1 demo2  demo3
+\begin{noteblock}
+\ttfamily
+xindex -q -l fr -b myDoc \newline
+xindex -l de -c DIN2 demo1 demo2  demo3\newline
 xindex -c norsk -o index.ind demo1 demo2.bdx  demo3.adx
-\end{verbatim}
+\end{noteblock}
 
 \begin{enumerate}
 \item \texttt{-q}: quiet; \texttt{-l fr}: french language setting; \texttt{-b}: no labels; \texttt{myDoc}: input data \texttt{myDoc} or \texttt{myDoc.idx)\newline
@@ -211,18 +214,19 @@
 
 It is also possible to use standard input for the index data, which needs the \verb|-s| parameter: 
 
-\begin{verbatim}
+\begin{noteblock}\ttfamily
 cat myDoc.idx | xindex -q -l fr -b -s 
 xindex -l de -c DIN2 < myDoc.idx
-\end{verbatim}
+\end{noteblock}
 
 
 
-
-The \Index{language} has to be chosen as an international abbreviation in lower- or uppercase letters, see 
+\begin{importantblock}
+The \Index{language} has to be chosen as an international abbreviation in 
+lower- or uppercase letters, see 
 \url{https://en.wikipedia.org/wiki/ISO_3166-2}
+\end{importantblock}
 
-
 \subsection{How it works}
 \XI creates by default an \Index{output} file \texttt{<input>.ind} which can be read
 by the \LaTeX\ document with the default command \Lcs{printindex}. One can use another
@@ -233,13 +237,20 @@
 like \texttt{ö}$\rightarrow$\texttt{o}. 
 
 \subsection{The \texttt{.idx} file}
-There are four characters which must be escaped if used in the command \Lcs{index}:
-\verb=!=, \verb=@=, \verb="=, or \verb=|=. These characters have a special meaning for 
-the index.\index{"!}\index{"@}\index{"|}
-The default \Index{escape character} is the double quote \verb|"|:
+There are three (four) characters which must be escaped if used in the command \Lcs{index}:
+\verb=!=, \verb=@=, or \verb=|= and the current escape character itself.  
+These characters have a special meaning for 
+the index.\index{"!}\index{"@}\index{"|} 
 
+\begin{importantblock}
+The default \Index{escape character} is the double quote \verb|"|. The braces
+\texttt{\{} and \texttt{\}} cannot be used as argument for the command \Lcs{index}.
+Use \Lcs{braceLeft} and \Lcs{braceRight} instead (defined in the package \Lpack{xindex}).
+\end{importantblock}
+
 \iffalse
-To put a !\index{"!}, @\index{"@}, or |\index{"|} character in an index entry, quote it by preceding the
+To put a !\index{"!}, @\index{"@}, or |\index{"|} character in an index entry, 
+quote it by preceding the
 character with a quote ". More precisely, any character is said to be quoted if it
 follows an unquoted " that is not part of a \" command. A quoted !, @, or
 | character is treated like an ordinary character rather than having its usual
@@ -353,19 +364,10 @@
 if one chooses another character.
 The escape character can be changed easily by the optional argument \verb|-e "<char>"| or 
 \verb|--escapechar "<char">|. The following example shows how
-it works for the \Index{escape character} > (greater). Internally the escape sequences are
-now defined as:
+it works for the \Index{escape character} »>« (greater). By default the expression »>!">« will
+be a \TeX\ ligature with the output »>>«. %Internally the escape sequences are
 
-\begin{verbatim}
-escape_chars = { -- by default " is the escape char
-  {esc_char..'"', '//escapedquote//',     '"'    },
-  {esc_char..'@', '//escapedat//',        '@'    },
-  {esc_char..'|', '//escapedvert//',      '|'    },
-  {esc_char..'!', '//scapedexcl//',       '!'    }
-}
-\end{verbatim}
-
-which is, of course, not of interest for the user. With the beginning the escaped chars
+With the beginning of \Lprog{xindex }the escaped chars
 are converted into the internal strings and later back to the origin meaning.
 The two characters \verb|{}| cannot be used as \verb|\{\}| inside the argument of \Lcs{index}.
 The package \Lpack{xindex} defines the two helper macros 
@@ -383,6 +385,7 @@
   frame,
   compiler=lualatex,
   crop,
+  force=true,
   xindex,
   xindexOptions=-e ">",
   runs=2,code,docType=latex,
@@ -407,8 +410,8 @@
 \begin{itemize}
 \item Exclamation mark ! \index{exclaim (>!)}
 \item Vertical bar| \index{Vertical bar (>|)}
-\item Doublequote \verb|"| \index{>"}
-\item Double doublequote \verb|""| \index{>">"}
+\item Escapechar \verb|>| \index{>>}
+\item Double escapechar \verb|>>| \index{>>>>}
 \item At character @ \index{At (>@)}
 \item Group start \{ \index{\braceLeft}
 \item Group end \{ \index{\braceRight}
@@ -425,9 +428,11 @@
 The \Index{language} is only important for the first two headers in the output of the index data.
 They are by default \emph{Symbols} followed by \emph{Numbers}. In a new version of \Lprog{xindex}
 it will be customizable.
-The predefined language is »en« and currently the following languages which its alias are possible:
+The predefined language is »en« and currently the following languages which its alias are defined:
 
+
 \begin{Verbatim}[commandchars=\\<>]
+<id> = {<symbols>, <numbers>, <alias language name>, ...}
 indexheader = { 
   cs = {"Symboly", "Čísla", "czech"},
   da = {"Symboler", "Tal", "danish"},
@@ -451,6 +456,7 @@
   frame,
   compiler=lualatex,
   crop,
+  force=true,
   xindex,
   xindexOptions=-l it -e ">",
   runs=2,code,docType=latex,
@@ -471,15 +477,15 @@
 %StopVisiblePreamble
 \pagestyle{empty}
 \begin{document}
-\section{Escaping characters with >}
+\section{Escaping simboli con >}
 \begin{itemize}
-\item Exclamation mark ! \index{exclaim (>!)}
-\item Vertical bar| \index{Vertical bar (>|)}
-\item Doublequote \verb|"| \index{>"}
-\item Double doublequote \verb|""| \index{>">"}
-\item At character @ \index{At (>@)}
+\item punto esclamativo ! \index{exclaim (>!)}
+\item linea verticale | \index{Vertical bar (>|)}
+\item escapechar \verb|>| \index{>>}
+\item doppio escapechar \verb|>>| \index{>>>>}
+\item At siboli @ \index{At (>@)}
 \end{itemize}
-Run \texttt{xindex} with \texttt{xindex -l it -e ">"}\index{123}
+Initio \texttt{xindex} con \texttt{xindex -l it -e ">"}\index{123}
 \newpage
 \printindex
 \end{document}
@@ -486,8 +492,10 @@
 \end{externalDocument}
 
 
-The following example was run with \verb|xindex -k <file>.idx|. In this case \verb|xindex| tries to detect the language  from
-the \Lfile{aux} file(s). This is only possible if  package \Lpack{babel} or \Lpack{polyglossia} are used.
+The following example was run with \verb|xindex -k <file>.idx|. 
+In this case \verb|xindex| tries to detect the language  from
+the \Lfile{aux} file(s). This is only possible if  
+package \Lpack{babel} or \Lpack{polyglossia} are used.
 
 \begin{externalDocument}[
 %  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
@@ -495,6 +503,7 @@
   frame,
   compiler=lualatex,
   crop,
+  force=true,
   xindex,
   xindexOptions=-k -e "?",
   runs=2,code,docType=latex,
@@ -510,7 +519,7 @@
   \let\item\@idxitem}
 \makeatother
 %StartVisiblePreamble
-\usepackage[dutch]{babel}
+\usepackage[dutch]{babel} % !!!!
 \usepackage{makeidx}\makeindex
 %StopVisiblePreamble
 \pagestyle{empty}
@@ -519,12 +528,12 @@
 \begin{itemize}
 \item Exclamation mark ! \index{exclaim (?!)}
 \item Vertical bar| \index{Vertical bar (?|)}
-\item Doublequote \verb|"| \index{?"}
-\item Double doublequote \verb|""| \index{?"?"}
-\item At character @ \index{At (?@)}
+\item Escapechar \verb|?| \index{??}
+\item Double escapechar \verb|??| \index{????}
+\item At character @ \index{At (?@)}\index{?@}
 \end{itemize}
 Run \texttt{xindex} with \texttt{xindex -k -e "?"}\index{123}
-\newpage
+\newpage\index{xindex@\texttt{xindex}}
 \printindex
 \end{document}
 \end{externalDocument}
@@ -865,6 +874,9 @@
 \end{externalDocument}
 %\end{minipage}
 
+
+\setsansfont{Libertinus Sans}\rmfamily
+
 \subsection{Sorting by using UCA (Unicode Collation Algorithm)}
 With the optional argument \verb|-u| or alternatively \verb|--use_UCA| the sorting will be done
 by Michal Hoftich's Lua package \texttt{LUA-UCA}, which should be part of any \TeX{} installation.
@@ -874,7 +886,21 @@
 UCA should be don't in the file \Lfile{xindex-cfg-uca.lua}, which will automatically be read
 by \Lprog{xindex}.
 
+\iffalse
+\begin{noteblock}
+This package can display, in a 
+\begin{itemize}
+	\item to change dimensions and colors ;
+\end{itemize}
+It's 
+\end{noteblock}
+\fi
+\begin{importantblock}
+If possible, you should use the Unicode sorting by default and only for some special cases
+where you define your own sorting scheme, you should not use the \verb|-u| option.
+\end{importantblock}
 
+
 \begin{externalDocument}[
 %  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
   mpwidth=0.55\linewidth,
@@ -1151,8 +1177,11 @@
   crop,
   xindex,
   xindexOptions=-l fr,
-  runs=2,code,docType=latex,
+  runs=2,
+  code,docType=latex,
   showFilename,
+%  runsequence={lualatex,{xindex -l fr},lualatex,lualatex},
+%  shellesc=false,
   align=\centering,
   lstOptions={columns=fixed}]{xindex}
 %! lualatex
@@ -1202,6 +1231,7 @@
   frame=false,
   compiler=lualatex,
   crop,
+  force=true,
   xindex,
   xindexOptions=-l de,
   runs=2,code,docType=latex,
@@ -1263,6 +1293,7 @@
   frame=true,
   compiler=lualatex,
   verbose,
+  shellesc,
 %  xindex,
 %  xindexOptions=-c description -g, 
   runs=2,
@@ -1270,7 +1301,7 @@
   force=true,
  %xindex -c description -n -g xindex-17.idx
  %xindex -c description -n --no_pagenumber gls.idx
-  runsequence={lualatex,{xindex -c description -n -g},lualatex,lualatex}
+%  runsequence={lualatex,{xindex -c description -n -g},lualatex,lualatex},
   showFilename,
   align=\centering,
   grfOptions={width=0.45\linewidth},
@@ -1733,7 +1764,66 @@
 
 
 
+The following example fixes a problem with \Lpack{hyperref} and escaping the | character,
+e.g.\verb/"|/. In such a case \Lpack{hyperref} ignores the vertical bar.
+With the optional parameter \verb/-f | --fix_hyperref/, which is still experimental,
+\Lprog{xindex} tries to fix this problem. However, instead
+of using this problematic vertical character, you can use \Lcs{textbar}, which also solves the
+problem.
 
+
+\begin{externalDocument}[
+%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
+%  mpwidth=0.55\linewidth,
+  pages={3},
+  frame=false,
+  compiler=lualatex, 
+  crop,
+  force=true,
+  shellesc,
+%  xindex,
+%  xindexOptions=-,
+  runs=2,code,docType=latex,
+  showFilename,
+  align=\centering,
+%  grfOptions={width=\linewidth},
+  lstOptions={columns=fixed}]{xindex}
+%! lualatex --shell-escape
+\documentclass{article}
+\usepackage{libertinus}
+\let\NewPage\newpage% only for demo
+\makeatletter
+\renewcommand\newpage{\NewPage\let\ps at plain\ps at empty}
+\makeatother
+%StartVisiblePreamble
+\usepackage[imakeidx]{xindex}
+\usepackage{hvindex}
+\makeindex[columns=5, columnsep=6pt, options=--fix_hyperref]
+\usepackage{hyperref}
+%StopVisiblePreamble
+\pagestyle{empty}
+\begin{document}
+	Symbols:\\
+	! \index{"!} " \index{""} \# \index{#@\#} \$ \index{$@\$}
+	\% \index{%@\%} \& \index{&@\&} ' \index{'} ) \index{)}
+	( \index{(} * \index{*} + \index{+} , \index{,@,\,}
+	- \index{-} . \index{.} / \index{/} : \index{:}
+	; \index{;} < \index{<} = \index{=} > \index{>}
+	? \index{?} @ \index{"@} [ \index{[} ] \index{]}
+	\_ \index{_@\_} ` \index{`} | \index{\textbar}
+	\newpage\index{"|}\index{\textbar}\index{123}\Index{Post}
+	\{ \index{\braceLeft} \} \index{\braceRight}
+	\textbackslash \index{\@\textbackslash}
+	\textasciicircum \index{^@\textasciicircum}
+	\textasciitilde \index{~@\textasciitilde}
+	Alphabet: \Index{Z},\Index{Zeppelin}\Index{Foo}\dots
+	\Index{...@\ldots}
+	\printindex
+\end{document}
+\end{externalDocument}
+
+
+
 \section{Including \LaTeX\ commands into the \Lext{idx} file}
 The command \Lcs{addtocontents} doesn't work for the index file. With the \LaTeX\ package
 \Lpack{xindex} (same name as the Lua program \Lprog{xindex}) defines a macro \Lcs{writeidx}
@@ -2194,7 +2284,7 @@
 \end{externalDocument}
 
 
-\clearpage
+%\clearpage
 
 
 \begin{externalDocument}[
@@ -2231,59 +2321,6 @@
 \end{document}
 \end{externalDocument}
 
-The following example fixes a problem with \Lpack{hyperref} and escaping the | character
-
-
-\begin{externalDocument}[
-%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
-%  mpwidth=0.55\linewidth,
-  pages={3},
-  frame=false,
-  compiler=lualatex, 
-  crop,
-  force=true,
-  shellesc,
-%  xindex,
-%  xindexOptions=-,
-  runs=2,code,docType=latex,
-  showFilename,
-  align=\centering,
-%  grfOptions={width=\linewidth},
-  lstOptions={columns=fixed}]{xindex}
-%! lualatex --shell-escape
-\documentclass{article}
-\usepackage{libertinus}
-\let\NewPage\newpage% only for demo
-\makeatletter
-\renewcommand\newpage{\NewPage\let\ps at plain\ps at empty}
-\makeatother
-%StartVisiblePreamble
-\usepackage[imakeidx]{xindex}
-\usepackage{hvindex}
-\makeindex[columns=4, columnsep=6pt, options=--fix_hyperref]
-\usepackage[unicode]{hyperref}
-%StopVisiblePreamble
-\pagestyle{empty}
-\begin{document}
-	Symbols:\\
-	! \index{"!} " \index{""} \# \index{#@\#} \$ \index{$@\$}
-	\% \index{%@\%} \& \index{&@\&} ' \index{'} ) \index{)}
-	( \index{(} * \index{*} + \index{+} , \index{,@,\,}
-	- \index{-} . \index{.} / \index{/} : \index{:}
-	; \index{;} < \index{<} = \index{=} > \index{>}
-	? \index{?} @ \index{"@} [ \index{[} ] \index{]}
-	\_ \index{_@\_} ` \index{`} | \index{\textbar}
-	\newpage\index{"|}\index{123}\Index{Post}
-	\{ \index{\braceLeft} \} \index{\braceRight}
-	\textbackslash \index{\@\textbackslash}
-	\textasciicircum \index{^@\textasciicircum}
-	\textasciitilde \index{~@\textasciitilde}
-	Alphabet: \Index{Z},\Index{Zeppelin}\Index{Foo}\dots
-	\Index{...@\ldots}
-	\printindex
-\end{document}
-\end{externalDocument}
-
 \printindex
 
 \end{document}

Modified: trunk/Master/texmf-dist/scripts/xindex/xindex.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/xindex/xindex.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/scripts/xindex/xindex.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
         xindex = xindex or { }
- local version = 0.51
+ local version = 0.53
 xindex.version = version
 --xindex.self = "xindex"
 
@@ -43,21 +43,21 @@
     -q,--quiet
     -h,--help
     -v...          Verbosity level; can be -v, -vv, -vvv
+    -V,--version
+    -a,--no_casesensitive
+    -b,--no_labels
     -c,--config (default cfg)
     -e,--escapechar (default ")
     -f,--fix_hyperref
-    -n,--noheadings 
-    -a,--no_casesensitive
-    -b,--no_labels
+    -g,--no_pagenumber
     -i,--ignoreSpace
-    -o,--output (default "")
     -k,--checklang               
     -l,--language (default en)   
-    -g,--no_pagenumber
+    -n,--noheadings 
+    -o,--output (default "")
     -p,--prefix (default L)
+    -s,--use_stdin
     -u,--use_UCA 
-    -s,--use_stdin
-    -V,--version
     <files...> (default stdin) .idx file(s)
 ]]
 
@@ -223,18 +223,18 @@
 alphabet_upper_map = CreateCharListMap(alphabet_upper)
 
 esc_char = args.escapechar
+esc_char2 = esc_char..esc_char  
 writeLog(2,"Escapechar = "..esc_char.."\n",1)
 escape_chars = { -- by default " is the escape char
-  {esc_char..'"', '//escapedquote//',     '"'    },
-  {esc_char..'@', '//escapedat//',        '@'    },
-  {esc_char..'|', '//escapedvert//',      '|'    },
-  {esc_char..'!', '//escapedexcl//',      '!'    }
---  {esc_char..'%(', '//escapedparenleft//', '('    },  -- ( must beescaped
---  {esc_char..'%)', '//escapedparenright//',')'    }   -- )  "      "
+  {esc_char2,     '//escaped2//', esc_char    },
+  {esc_char..'@', '//escapedat//',    '@'    },
+  {esc_char..'|', '//escapedvert//',  '|'    },
+  {esc_char..'!', '//escapedexcl//',  '!'    },
+  {'',            '\\textbar',        '|'    },  
+  {'',            '\\braceLeft',      '{'    },  
+  {'',            '\\braceRight',     '}'    }
 }
 
--- esc_char..'%( is not needed because it can only appear after |
-
 outFile = io.open(outfilename,"w+")
 
 check_language = args["checklang"]

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-AU'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -11,7 +11,7 @@
 -- configuration for index files of the Heidelberger Akademie der Wissenschaften
 
 if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-RU'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex.lua",
        author = "Alexey Kuznetzov",
     copyright = "Herbert Voß",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -8,7 +8,7 @@
 -- $Id: xindex-base.lua 22 2022-02-07 12:18:15Z hvoss $
 -----------------------------------------------------------------------
 
-local info = { version = 0.51 } 
+local info = { version = 0.53 } 
 
 -- check config
 if pageNoPrefixDel ~= "" then 
@@ -49,16 +49,16 @@
 
 writeLog(1,"check for hyperpages ... ",0)
 hyperpage, lines = checkHyperpage(lines)  -- hyperref used?
-writeLog(1,"done \n",0)
+--writeLog(1,"done \n",0)
 if hyperpage then writeLog(1,"We have hyperpages.\n",1) end
 
 print("Presort of \\indexentry lines")
 -- for _,l in pairs(lines) do print (l) end
 table.sort(lines)
-if vlevel > 1 then 
-  print("Pre-Sorted index list:")
-  for _,l in pairs(lines) do print (l) end
-end
+--if vlevel > 1 then 
+  --print("Pre-Sorted index list:")
+  --for _,l in pairs(lines) do print (l) end
+--end
 
 if vlevel > 1 then 
   writeLog(1,"--------------- Input data (presorted) -----------------\n",2)
@@ -74,11 +74,15 @@
 
 writeLog(1,"Change escape chars with macros ... \n",0)
 for k,v in ipairs(lines) do  
+  --print("(k,v) ",k,v)
   if not commandEntry(v) then
+    --print()
+    --print(require 'xindex-pretty'.dump(escape_chars))   -- only for internal dump
+    --print()
     for i, str0 in ipairs(escape_chars) do  -- str0: esc-char, coded, char
---      print(str0[1],str0[2],v)
-      v = string.gsub(v,str0[1],str0[2])
---      print("==> "..v)
+      if i < 5 then 
+        v,changed = v:gsub(literalize(str0[1]),str0[2]) -- some chars must be escaped
+      end
     end
     if k < #lines then
       if commandEntry(lines[k+1]) then   -- is the next line not a \indexentry ?
@@ -177,14 +181,11 @@
   writeLog(2,"done\n",0)
 else
   for i=1, #NewIndex do
-    v = NewIndex[i]
-    if findStr(v["SortKey"],"\\braceLeft") < 2      then v["SortKey"] = '{' v["sortChar"] = '{'end
-    if findStr(v["SortKey"],"\\braceRight") < 2     then v["SortKey"] = '}' end
-    if findStr(v["SortKey"],"//escapedexcl//") < 2  then v["SortKey"] = '!' end
-    if findStr(v["SortKey"],"//escapedquote//") < 2 then v["SortKey"] = '"' end
-    if findStr(v["SortKey"],"//escapedat//") < 2    then v["SortKey"] = '@' end
-    if findStr(v["SortKey"],"//escapedvert//") < 2  then v["SortKey"] = '|' end
-    NewIndex[i] = v
+    if NewIndex[i]["SortKey"] ~= nil then
+      for _,w in pairs(escape_chars) do 
+        NewIndex[i]["SortKey"] = NewIndex[i]["SortKey"]:gsub(w[2], w[3])
+      end
+    end
   end
 end
 

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-baselib'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "base library  to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-cfg-common'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex-cfg-uca.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-cfg'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "main configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-cfg'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration file for the DANTE Edition",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-cfg'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "DTK configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-lib'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "main library  to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",
@@ -97,6 +97,10 @@
   return table.concat(str)
 end
   
+function literalize(s)  -- escaping characters ( ) . % + - * ? [ ] ^ $ with %
+    return s:gsub("[%(%)%.%%%+%-%*%?%[%]%^%$]", function(c) return "%" .. c end)
+end  
+  
 --  local strOrigTrue = strOrig
 --  strOrig = table.concat(str)
 --  c = string.upper(get_normalized_char(alphabet_upper,utf.sub(strOrig,1,1)))
@@ -238,6 +242,7 @@
 end
 
 function replaceVerticalChar(v)
+  --if not v then return v,"" end
   if not v:match('|') then 
     return v,""
   else 
@@ -549,6 +554,12 @@
     else
       a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
     end
+    for _,v in pairs(escape_chars) do 
+      V2 = NormalizedUpper(v[2])
+      V3 = NormalizedUpper(v[3])
+      a["SortKey"] = a["SortKey"]:gsub(V2, V3)
+    end
+    -- print("-a:"..a["SortKey"])
   else  
     A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!',' ')) -- replace! by empty
     if ignoreSpace then
@@ -556,15 +567,12 @@
     else
       a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
     end
+    -- print("-a:"..a["SortKey"])
+    for _,v in pairs(escape_chars) do 
+      a["SortKey"] = a["SortKey"]:gsub(v[2], v[3])
+    end
   end
 --  s:gsub("%s+", "")  strip spaces
-  if findStr(a["SortKey"],"\\braceLeft") < 2      then a["SortKey"] = '{  '..Apage end
-  if findStr(a["SortKey"],"\\braceRight") < 2     then a["SortKey"] = '}  '..Apage end
-  if findStr(a["SortKey"],"//escapedexcl//") < 2  then a["SortKey"] = '!  '..Apage end
-  if findStr(a["SortKey"],"//escapedquote//") < 2 then a["SortKey"] = '"  '..Apage end
-  if findStr(a["SortKey"],"//escapedat//") < 2    then a["SortKey"] = '@  '..Apage end
-  if findStr(a["SortKey"],"//escapedvert//") < 2  then a["SortKey"] = '|  '..Apage end
---  if findStr(a["SortKey"],"\\textbar") < 2  then a["SortKey"] = '|  '..Apage end
   --  a["SortKey"] = a["SortKey"]:gsub("%s+", "")
   if not use_UCA then           -- test if it is a symbol after 9 and before A or after Z
     if (a["SortKey"]:byte() > 57 and a["SortKey"]:byte() < 65) or 
@@ -573,7 +581,7 @@
       a["SortKey"] = "/"..a["SortKey"]     -- sort it after /
     end
   end   
-  -- print("Sortkey: " .. a["SortKey"])
+  --print("Sortkey: " .. a["SortKey"])
 end
 
 function GenerateSortKeys(Index)
@@ -591,7 +599,7 @@
   else
     compare = A<B
   end
-  writeLog(1,"UTFCompare: A--B "..A.."--"..B.."A<B:"..tostring(compare).."\n",2)
+  writeLog(1,"UTFCompare: "..A.."<"..B.." : "..tostring(compare).."\n",2)
   return compare
 end
 
@@ -786,18 +794,54 @@
     if fix_hyperref then
       writeLog(1,"fix vertical bar with hyperref ... ",0)
       -- hyperref ignores the vertical bar in "| and also other escape chars
+      -- 
+      -- \index{"|}    -> \indexentry{"|hyperpage}{1} -> \textbar|hyperpage
+      -- \index{foo"|bar} -> \indexentry{foo"|hyperindexformat{\bar}}{1} -> foo\textbar bar|hyperpage
     end
-    local sub_str = esc_char..'|hyperpage'
+    local sub_str0 = esc_char..'|hyperpage'
+    local sub_str1 = esc_char..'|hyperindexformat'
     for i=1,#lines do
+      local l = lines[i]
       if fix_hyperref then
-        s = lines[i]:find(sub_str) 
-        print(i,lines[i],s)
-        if s == nil then s = 0 end
-        if s == 2 then
-          lines[i] = lines[i]:gsub(sub_str, '\\textbar|hyperpage') -- "| -> \textbar
+        s0 = l:find(sub_str0)           -- test for hyperpage
+        s1 = l:find(esc_char..sub_str0)
+        --print(i,l,s0,s1)
+        if s0 == nil then 
+          s0 = 0 
+          s1 = 0
         end
+        if s1 == nil and s0 > 0 then -- no ""| 
+          l = l:gsub(sub_str0, '\\textbar|hyperpage') -- "| -> \textbar
+        else
+          -- part 2
+          s0 = l:find(sub_str1) 
+          s1 = l:find(esc_char..sub_str1)
+          --print(i,l,s0,s1)
+          if s0 == nil then 
+            s0 = 0 
+            s1 = 0
+          elseif s1 == nil then
+            s1 = 0
+          end
+          if s1 == 0 and s0 > 0 then
+          -- get foo and bar from {foo"|hyperindexformat{\bar}}
+	  	    items = l:gmatch("%{(.-)%}")
+            var = {}
+            for item in items do 
+              var[#var+1] = item
+            end
+            if s0 > 2 then
+              u1 = var[1]:split('"|')[1]  -- foo
+            else
+              u1 = ''
+            end
+            v1 = var[1]:split("\\")[2]  -- bar
+            l = '{'..u1..'\\textbar '..v1.."|hyperpage}{"..var[2].."}"  
+            -- l = foo"|bar -> foo\textbar bar
+          end
+        end
       end
-      lines[i] = string.gsub(lines[i],'|?hyperpage}{','}{')
+      lines[i] = string.gsub(l,'|?hyperpage}{','}{')
     end  -- for
     writeLog(1,"done\n",0)
     return true, lines
@@ -825,7 +869,9 @@
       str = "  \\item "..Entry.."\n"
     end
     for i, str0 in ipairs(escape_chars) do       -- undo the escape char setting
-      str = str:gsub(str0[2],str0[3])
+      if i < 5 then
+        str = str:gsub(str0[2],str0[3])
+      end
     end
     outFile:write(str); indLines=indLines+1
     lastItems = {}
@@ -858,7 +904,9 @@
           end
         end  
         for i, str0 in ipairs(escape_chars) do       -- undo the escape char setting
-          str = string.gsub(str,str0[2],str0[3])
+          if i < 5 then
+            str = string.gsub(str,str0[2],str0[3])
+          end
         end
         outFile:write(str); indLines=indLines+1
       else

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -10,7 +10,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-no'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -7,7 +7,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-pretty'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "dump a Lua table for debugging",
        author = "Steve Donovan",
     copyright = "Steve Donovan",

Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua	2023-07-16 15:36:57 UTC (rev 67650)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua	2023-07-16 19:44:44 UTC (rev 67651)
@@ -9,7 +9,7 @@
 -----------------------------------------------------------------------
 
 if not modules then modules = { } end modules ['xindex-yannis'] = {
-      version = 0.51,
+      version = 0.53,
       comment = "main configuration to xindex.lua",
        author = "Herbert Voss",
     copyright = "Herbert Voss",



More information about the tex-live-commits mailing list.