diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-13 21:24:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-13 21:24:29 +0000 |
commit | bb1788443ceb234c15451f189aa9e6390576a0d6 (patch) | |
tree | 59d2c5874ec5d951481b803557d1c1b81d1f081b | |
parent | c792c4fcd935edbc5fb78b4f5d1df84aee0ea1ba (diff) |
xindex (13feb22)
git-svn-id: svn://tug.org/texlive/trunk@62002 c570f23f-e606-0410-a88d-b1316a301751
30 files changed, 591 insertions, 242 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua b/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua index 984187bf381..72ee4a48e1d 100755 --- a/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua +++ b/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua @@ -6,11 +6,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL 1.3 -- --- $Id: xindex.lua 21 2022-01-27 17:45:10Z hvoss $ +-- $Id: xindex.lua 22 2022-02-11 12:18:15Z hvoss $ ----------------------------------------------------------------------- xindex = xindex or { } - local version = 0.36 + local version = 0.40 xindex.version = version --xindex.self = "xindex" @@ -49,8 +49,10 @@ local args = require ('xindex-lapp') [[ -n,--noheadings -a,--no_casesensitive -b,--no_labels + -i,--ignoreSpace -o,--output (default "") - -l,--language (default en) + -k --checklang same as * star for checking aux file + -l,--language (default en) or * for detecting the language from the aux file -p,--prefix (default L) -u,--use_UCA -s,--use_stdin @@ -97,7 +99,9 @@ require('xindex-baselib') local nInFiles = #args.files if not useStdInput then - --print(tostring(nInFiles).." input files are given!") + if vlevel == 3 then + print(tostring(nInFiles).." input file(s): ") + end inFiles = {} --args.files as strings for i = 1,nInFiles do local file = args.files_name[i] @@ -108,6 +112,9 @@ if not useStdInput then else inFiles[#inFiles+1] = file end + if vlevel == 3 then + print(file) + end end end @@ -153,7 +160,7 @@ require('xindex-lib') writeLog(2,"xindex v."..version.." (c) Herbert Voß\n",-1) writeLog(1,"Verbose level = "..vlevel.."\n",1) -writeLog(2,"Logfile:"..logfilename,1) +writeLog(2,"Logfile:"..logfilename.."\n",1) writeLog(2,"Open outputfile "..outfilename,0) outFile = io.open(outfilename,"w+") @@ -172,6 +179,13 @@ end -- writeLog(2,"Using input file: "..inFile.."\n",0) +if args["ignoreSpace"] then + ignoreSpace = args["ignoreSpace"] +else + ignoreSpace = false +end +writeLog(2,"ignore space for sorting: "..tostring(ignoreSpace).."\n",-1) + labelPrefix = args.prefix writeLog(2,"Label prefix: "..labelPrefix.."\n",-1) @@ -208,9 +222,57 @@ escape_chars = { -- by default " is the escape char -- esc_char..'%( is not needed because it can only appear after | -language = "en" -- default language +outFile = io.open(outfilename,"w+") + +local aux_language = "" + +if args["checklang"] or (args["language"] == "*") then + writeLog(2,'Check language in aux file\n',0) + -- \babel@aux{german}{} package babel + -- \selectlanguage *[variant=german,spelling=new,]{german} package polyglossia + local auxfile = inFiles[1]:split(".")[1]..".aux" + writeLog(2,auxfile.."\n",0) + local auxlines = read_lines_from(auxfile) + for line = 1,#auxlines do + local str = auxlines[line] + if string.find(str, "selectlanguage") then + str = str:match("{..+}$") -- get last word {language} + aux_language = str:sub(2,(#str-1)) + break + else + if string.find(str, "babel@aux{") then + -- print("Babel defunden: "..str) + str = str:match("{..+}$") -- get last word {language} + -- print("Babel: "..str) + aux_language = str:sub(2,(#str-3)) + break + end + end + end +-- print(aux_language) + if #aux_language > 0 then +-- print("find language") + for i,lang in pairs(indexheader) do + for j = 3,#lang do + if lang[j] == aux_language then + language = i + end + end + end + else + language = "en" + end + print("Detected language: "..language) +else + if args["language"] then + language = string.lower(args["language"]):sub(1, 2) + else + language = "en" + end +end + +--print("Sprache:"..language) -language = string.lower(args["language"]):sub(1, 2) writeLog(2,"Language = "..language.."\n",1) if (indexheader[language] == nil) then writeLog(2,'Corrected the unknown language "'..language..'" to "en"'.."\n",0) diff --git a/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG b/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG index 70cae1d3542..ed1039f89a9 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG +++ b/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG @@ -1,3 +1,7 @@ +0.40 2022-02-12 - added -i,--ignoreSpace for sorting +0.39 2022-02-12 - detect language in aux file +0.38 2022-02-11 - modified setVersion.sh +0.37 2022-02-08 - fix for doubled see entries if roman pagenumbers are set 0.36 2022-02-07 - fix for introduced bug 0.35 2022-01-22 - fix for escape character - added language spain for folium pages and header diff --git a/Master/texmf-dist/doc/lualatex/xindex/README.md b/Master/texmf-dist/doc/lualatex/xindex/README.md index 6ddb92f8324..e9710684d01 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/README.md +++ b/Master/texmf-dist/doc/lualatex/xindex/README.md @@ -12,6 +12,7 @@ will be included in at least LuaTeX 1.09 (TeXLive 2019) * xindex-baselib.lua -- base file * xindex-lib.lua -- functions module * xindex-lapp.lua -- read parameter +* xindex-pretty.lua -- pretty printing of tables for debugging * xindex-unicode.lua -- list of Unicode categories The syntax of `xindex` @@ -32,6 +33,7 @@ possible options are (short,long): -n,--noheadings -a,--no_casesensitive -b,--no_labels + -i,--ignoreSpace -o,--output (default "") -l,--language (default en) -p,--prefix (default L) diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf Binary files differindex 43e7014edcc..c1ddc640f56 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf Binary files differindex 83a38ef56d8..671b16dba8e 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf Binary files differindex 1ae2761ab5f..2b37bbd8899 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf Binary files differindex 8f7695f8035..90ce8da0a77 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf Binary files differindex 07b47f5c4b0..5cc99006629 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf Binary files differindex bd5bd8371cb..8ee6506f672 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo2.ind b/Master/texmf-dist/doc/lualatex/xindex/tests/demo2.ind index 6bd956f8c66..a2bfb309fc2 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo2.ind +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo2.ind @@ -9,7 +9,7 @@ \indexspace \textbf{D}\label{L-xindex-D} \nopagebreak[4] - \item {Downes}, Michael, {xxxvi}, {xxxvii} + \item {Downes}, Michael, {xxxvif} \indexspace \textbf{F}\label{L-xindex-F} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf Binary files differindex 28ac172fd15..2d72ee52ebe 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf Binary files differindex 06202ce455c..7db4dc7fd29 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf Binary files differindex 882997ed02e..4ade479cc9d 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf +++ b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf diff --git a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex index 683a9064253..dec79692e71 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex +++ b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex @@ -1,4 +1,4 @@ -%% $Id: xindex-doc.tex 20 2022-01-22 10:37:29Z hvoss $ +%% $Id: xindex-doc.tex 22 2022-02-07 12:18:15Z hvoss $ % \listfiles\setcounter{errorcontextlines}{100} \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-, @@ -81,7 +81,7 @@ \def\setVersion#1{\setVVersion#1!!} \def\setVVersion#1=#2!!{\def\xIndexVersion{#2}} -\setVersion{version = 0.36}% can be automatically changed by perl +\setVersion{version = 0.40}% can be automatically changed by perl \setkeys{dtk}{cleanup=true,force} @@ -92,7 +92,7 @@ \begin{document} \maketitle \thispagestyle{empty} -\enlargethispage{1cm} +%\enlargethispage{1cm} \tableofcontents \vfill @@ -102,6 +102,7 @@ Denis Bitouzé; Brian Dunn; Gonzalo Pesquero Serrano; Michal Hoftich; +Mykel Kochenderfer; Frank Mittelbach; Heiko Oberdiek; Matteo Paolini; @@ -109,7 +110,6 @@ Stefan Pinnow; Florent Rougon; Martin Sievers; Simon Spiegel - \clearpage \section{Introduction} @@ -173,7 +173,9 @@ xindex [-a, --no_casesensitive ] default is false [-b,--no_labels ] default is false [-n,--noheadings ] default is false + [-i,--ignoreSpace ] default is false [-o,--output ] default is <input>.ind + [-k,--checklang ] default ist false [-l,--language ] default is en [-p,--prefix] default L [-u,--use_UCA ] default is false @@ -369,19 +371,20 @@ Run \texttt{xindex} with \texttt{xindex -e ">"}\index{<file.idx>}\index{123} 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 are possible: +The predefined language is »en« and currently the following languages which its alias are possible: \begin{Verbatim}[commandchars=\\<>] indexheader = { - cs = {"Symboly", "Čísla"}, - da = {"Symboler", "Tal"}, - de = {"Symbole", "Zahlen"}, - en = {"Symbols", "Numbers"}, - es = {"Símbolos", "Números"}, - fr = {"Symboles","Nombres"}, - it = {"Simboli", "Numeri"}, - \Japanese jp = {"シンボル","番号"}, - \DejaVuMono no = {"Symboler","Tall"}, + cs = {"Symboly", "Čísla", "czech"}, + da = {"Symboler", "Tal", "danish"}, + de = {"Symbole", "Zahlen", "austrian", "german", "germanb", "ngerman", "naustrian"}, + en = {"Symbols", "Numbers", "english", "USenglish", "american", "UKenglish", "british", "canadian", "australian", "newzealand"}, + es = {"Símbolos", "Números", "spanish"}, + fr = {"Symboles","Nombres", "french", "francais", "canadien", "acadian"}, + it = {"Simboli", "Numeri", "italian"}, + \Japanese jp = {"シンボル","番号","japanese"}, + \DejaVuMono nl = {"Symbolen", "Nummers", "dutch"}, + no = {"Symboler","Tall", "norsk", "nynorsk"}, } \end{Verbatim} @@ -402,6 +405,7 @@ The following example was run with \verb|xindex -l it <file>.idx|: lstOptions={columns=fixed}]{xindex} %! lualatex \documentclass{scrartcl} +\usepackage[italian]{babel} \makeatletter \def\theindex{% only for demonstration \section*{\indexname} @@ -428,6 +432,55 @@ Run \texttt{xindex} with \texttt{xindex -l it -e ">"}\index{123} \end{externalDocument} +The following example was run with \verb|xindex -l "*" <file>.idx|. Then the language is detected from +the \Lfile{aux} file. This is only possible if package \Lpack{babel} or \Lpack{polyglossia} are used. + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + pages={1,2}, + frame, + compiler=lualatex, + crop, + xindex, + xindexOptions=-l "*" -e "?", + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex +\documentclass{scrartcl} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\makeatother +%StartVisiblePreamble +\usepackage[canadien]{babel} +\usepackage{makeidx}\makeindex +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +\section{Escaping characters with ?} +\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 (?@)} +\end{itemize} +Run \texttt{xindex} with \texttt{xindex -l "*" -e "?"}\index{123} +\newpage +\printindex +\end{document} +\end{externalDocument} + +Instead of using \verb|-l *| one can also use the parameter \verb|-k| or \verb|--checklang|. + + + + \section{Sorting} \subsection{Default sorting by a character table} The default sorting is unicode aware and uses a translation table for accented characters: @@ -747,11 +800,205 @@ UCA should be don't in the file \Lfile{xindex-cfg-uca.lua}, which will automatic by \Lprog{xindex}. +\subsection{Case sensitive index entries} +By default \textsf{foo} and \textsf{Foo} are two different entries and will handled differently +by \Lprog{xindex}: \textsf{Foo} will be as an own entry \emph{before} \textsf{foo}. Let's see +a more complex example. In the index the entry \verb|xindex-DIN2.lua| is the first one of +the \verb|xindex-???| series because uppercase letters are sorted before lowercase letters. + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + mpwidth=0.55\linewidth, + pages={2}, + frame=false, + compiler=lualatex --shell-escape, + crop, + xindex, +% xindexOptions=, + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex --shell-escape +\documentclass{scrartcl} +\usepackage{libertinus-otf} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\makeatother +\begin{filecontents}[force,noheader]{\jobname.idx} +\indexentry{xindex package@\texttt {xindex} package|hyperpage}{2} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{4} +\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{6} +\indexentry{xindex-newfile.lua file@\texttt {xindex-newfile.lua} file|hyperpage}{6} +\indexentry{xindex-DIN2.lua file@\texttt {xindex-DIN2.lua} file|hyperpage}{6} +\indexentry{xindex-cfg-common.cfg file@\texttt {xindex-cfg-common.cfg} file|hyperpage}{9} +\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{10} +\indexentry{xindex-HAdW-eKO.lua file@\texttt {xindex-HAdW-eKO.lua} file|hyperpage}{10} +\indexentry{xindex-dtk.lua file@\texttt {xindex-dtk.lua} file|hyperpage}{12} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{13} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{14} +\indexentry{xindex-cfg-common.lua file@\texttt {xindex-cfg-common.lua} file|hyperpage}{14} +\indexentry{xindex package@\texttt {xindex} package|hyperpage}{15} +\end{filecontents} +%StartVisiblePreamble +\usepackage{makeidx} +\usepackage{hyperref} +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +foo\newpage +\printindex +\end{document} +\end{externalDocument} + + + +The same example sorted with the \verb|-a| or \verb|--nocasesensitive| has another output: now +\verb|xindex-cfg-common.lua| is the first one of the \verb|xindex-???| series. + + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + mpwidth=0.55\linewidth, + pages={2}, + frame=false, + compiler=lualatex --shell-escape, + crop, + xindex, + xindexOptions=-a, + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex --shell-escape +\documentclass{scrartcl} +\usepackage{libertinus-otf} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\makeatother +\begin{filecontents}[force,noheader]{\jobname.idx} +\indexentry{xindex package@\texttt {xindex} package|hyperpage}{2} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{4} +\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{6} +\indexentry{xindex-newfile.lua file@\texttt {xindex-newfile.lua} file|hyperpage}{6} +\indexentry{xindex-DIN2.lua file@\texttt {xindex-DIN2.lua} file|hyperpage}{6} +\indexentry{xindex-cfg-common.cfg file@\texttt {xindex-cfg-common.cfg} file|hyperpage}{9} +\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{10} +\indexentry{xindex-HAdW-eKO.lua file@\texttt {xindex-HAdW-eKO.lua} file|hyperpage}{10} +\indexentry{xindex-dtk.lua file@\texttt {xindex-dtk.lua} file|hyperpage}{12} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{13} +\indexentry{xindex program@\texttt {xindex} program|hyperpage}{14} +\indexentry{xindex-cfg-common.lua file@\texttt {xindex-cfg-common.lua} file|hyperpage}{14} +\indexentry{xindex package@\texttt {xindex} package|hyperpage}{15} +\end{filecontents} +%StartVisiblePreamble +\usepackage{makeidx} +\usepackage{hyperref} +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +foo\newpage +\printindex +\end{document} +\end{externalDocument} + + + + + + + +\subsection{Ignore space for sorting} +By default \textsf{alpha sort} will be sorted \emph{before} \textsf{alphaA}: + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + mpwidth=0.55\linewidth, + pages={2}, + frame=false, + compiler=lualatex --shell-escape, + crop, + xindex, +% xindexOptions=, + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex --shell-escape +\documentclass{scrartcl} +\usepackage{libertinus-otf} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\makeatother +%StartVisiblePreamble +\usepackage{makeidx}\makeindex +% default sorting +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +Test +\index{alpha sort}\index{alphaA} +\newpage +\printindex +\end{document} +\end{externalDocument} + + +This can be changed with the optional argument \verb|-i| or \verb|--ignoreSpace|: + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + mpwidth=0.55\linewidth, + pages={2}, + frame=false, + compiler=lualatex --shell-escape, + crop, + xindex, + xindexOptions=-i, + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex --shell-escape +\documentclass{scrartcl} +\usepackage{libertinus-otf} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\makeatother +%StartVisiblePreamble +\usepackage{makeidx}\makeindex +% sort with xindex -i <file> +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +Test +\index{alpha sort}\index{alphaA} +\newpage +\printindex +\end{document} +\end{externalDocument} + %\clearpage -\section{Compressing pagenumbers}\label{Compressing} +\subsection{Compressing pagenumber series}\label{Compressing} By default page sequences of an entry are compressed to \begin{description} \item[8f] page 8 and 9 @@ -820,62 +1067,7 @@ foo\index{foo}foobar\index{foobar|)} \end{externalDocument} - -\section{\texttt{hyperref}} - -Using the package \Lpack{hyperref} is no problem: - -\enlargethispage{2.5\normalbaselineskip} - -\begin{externalDocument}[ -% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, - mpwidth=0.55\linewidth, - pages={3}, - frame=false, - compiler=lualatex, - crop, - xindex, - xindexOptions=-l de, - force=true, - runs=2,code,docType=latex, - showFilename, - align=\centering, - lstOptions={columns=fixed}]{xindex} -%! lualatex -\documentclass[paper=a6]{scrartcl} -\usepackage{multicol} -\makeatletter -\def\theindex{% only for demonstration - \section*{\indexname} - \begin{multicols}{2} - \parskip\z@ \@plus .3\p@\relax \parindent\z@ - \let\item\@idxitem} -\def\endtheindex{\end{multicols}} -\makeatother -%StartVisiblePreamble -\usepackage{makeidx}\makeindex -\usepackage{hvindex}% for \Index -\usepackage[colorlinks]{hyperref} -%StopVisiblePreamble -\pagestyle{empty} -\begin{document} -Sorted with \verb|-l DE| -\Index{Österreich} \Index{Öresund} -\Index{Ostern} \Index{Ober} \Index{Oberin} -\Index{Österreich} \index{Öresund|textbf} -\Index{Ostern} \Index{Ober} \Index{Oberin} -\Index{Obstler} \Index{Öl} \Index{ölen} -\Index{Ödem} \Index{Oligarch} \Index{Oder} -\Index{oder} \index{Fluss!Oder|textit} -\Index{Oder|seealso{Fluss}} \Index{Göbel} -\Index{Goethe} \Index{Göthe} \Index{Götz} -\newpage\Index{Goldmann} \Index{Goethe} -\newpage \printindex -\end{document} -\end{externalDocument} - - -\section{Page argument} +\subsection{Modify Pagenumber} Every page can be combined with an additional macro, like \verb=\index{foo|fbox}=, the page number will be set into a framebox. If we have on the same page the two commands: @@ -930,6 +1122,8 @@ und foo\index{foo|fbox} + + \section{The config file} The main config file is \Lfile{xindex-cfg.lua} is used by default and loading it by the @@ -1245,6 +1439,59 @@ baz\index{foo!bar!baz} foobar% +\section{\texttt{hyperref}} + +Using the package \Lpack{hyperref} is no problem: + +\enlargethispage{2.5\normalbaselineskip} + +\begin{externalDocument}[ +% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, + mpwidth=0.55\linewidth, + pages={3}, + frame=false, + compiler=lualatex, + crop, + xindex, + xindexOptions=-l de, + force=true, + runs=2,code,docType=latex, + showFilename, + align=\centering, + lstOptions={columns=fixed}]{xindex} +%! lualatex +\documentclass[paper=a6]{scrartcl} +\usepackage{multicol} +\makeatletter +\def\theindex{% only for demonstration + \section*{\indexname} + \begin{multicols}{2} + \parskip\z@ \@plus .3\p@\relax \parindent\z@ + \let\item\@idxitem} +\def\endtheindex{\end{multicols}} +\makeatother +%StartVisiblePreamble +\usepackage{makeidx}\makeindex +\usepackage{hvindex}% for \Index +\usepackage[colorlinks]{hyperref} +%StopVisiblePreamble +\pagestyle{empty} +\begin{document} +Sorted with \verb|-l DE| +\Index{Österreich} \Index{Öresund} +\Index{Ostern} \Index{Ober} \Index{Oberin} +\Index{Österreich} \index{Öresund|textbf} +\Index{Ostern} \Index{Ober} \Index{Oberin} +\Index{Obstler} \Index{Öl} \Index{ölen} +\Index{Ödem} \Index{Oligarch} \Index{Oder} +\Index{oder} \index{Fluss!Oder|textit} +\Index{Oder|seealso{Fluss}} \Index{Göbel} +\Index{Goethe} \Index{Göthe} \Index{Götz} +\newpage\Index{Goldmann} \Index{Goethe} +\newpage \printindex +\end{document} +\end{externalDocument} + @@ -1514,116 +1761,6 @@ run \verb|xindex -c header <file.idx>| -\section{Case sensitive index entries} -By default \textsf{foo} and \textsf{Foo} are two different entries and will handled differently -by \Lprog{xindex}: \textsf{Foo} will be as an own entry \emph{before} \textsf{foo}. Let's see -a more complex example. In the index the entry \verb|xindex-DIN2.lua| is the first one of -the \verb|xindex-???| series because uppercase letters are sorted before lowercase letters. - -\begin{externalDocument}[ -% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, - mpwidth=0.55\linewidth, - pages={2}, - frame=false, - compiler=lualatex --shell-escape, - crop, - xindex, -% xindexOptions=, - force=true, - runs=2,code,docType=latex, - showFilename, - align=\centering, - lstOptions={columns=fixed}]{xindex} -%! lualatex --shell-escape -\documentclass{scrartcl} -\usepackage{libertinus-otf} -\makeatletter -\def\theindex{% only for demonstration - \section*{\indexname} - \parskip\z@ \@plus .3\p@\relax \parindent\z@ - \let\item\@idxitem} -\makeatother -\begin{filecontents}[force,noheader]{\jobname.idx} -\indexentry{xindex package@\texttt {xindex} package|hyperpage}{2} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{4} -\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{6} -\indexentry{xindex-newfile.lua file@\texttt {xindex-newfile.lua} file|hyperpage}{6} -\indexentry{xindex-DIN2.lua file@\texttt {xindex-DIN2.lua} file|hyperpage}{6} -\indexentry{xindex-cfg-common.cfg file@\texttt {xindex-cfg-common.cfg} file|hyperpage}{9} -\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{10} -\indexentry{xindex-HAdW-eKO.lua file@\texttt {xindex-HAdW-eKO.lua} file|hyperpage}{10} -\indexentry{xindex-dtk.lua file@\texttt {xindex-dtk.lua} file|hyperpage}{12} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{13} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{14} -\indexentry{xindex-cfg-common.lua file@\texttt {xindex-cfg-common.lua} file|hyperpage}{14} -\indexentry{xindex package@\texttt {xindex} package|hyperpage}{15} -\end{filecontents} -%StartVisiblePreamble -\usepackage{makeidx} -\usepackage{hyperref} -%StopVisiblePreamble -\pagestyle{empty} -\begin{document} -foo\newpage -\printindex -\end{document} -\end{externalDocument} - - -The same example sorted with the \verb|-a| or \verb|--nocasesensitive| has another output: now -\verb|xindex-cfg-common.lua| is the first one of the \verb|xindex-???| series. - - -\begin{externalDocument}[ -% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule}, - mpwidth=0.55\linewidth, - pages={2}, - frame=false, - compiler=lualatex --shell-escape, - crop, - xindex, - xindexOptions=-a, - force=true, - runs=2,code,docType=latex, - showFilename, - align=\centering, - lstOptions={columns=fixed}]{xindex} -%! lualatex --shell-escape -\documentclass{scrartcl} -\usepackage{libertinus-otf} -\makeatletter -\def\theindex{% only for demonstration - \section*{\indexname} - \parskip\z@ \@plus .3\p@\relax \parindent\z@ - \let\item\@idxitem} -\makeatother -\begin{filecontents}[force,noheader]{\jobname.idx} -\indexentry{xindex package@\texttt {xindex} package|hyperpage}{2} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{4} -\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{6} -\indexentry{xindex-newfile.lua file@\texttt {xindex-newfile.lua} file|hyperpage}{6} -\indexentry{xindex-DIN2.lua file@\texttt {xindex-DIN2.lua} file|hyperpage}{6} -\indexentry{xindex-cfg-common.cfg file@\texttt {xindex-cfg-common.cfg} file|hyperpage}{9} -\indexentry{xindex-cfg.lua file@\texttt {xindex-cfg.lua} file|hyperpage}{10} -\indexentry{xindex-HAdW-eKO.lua file@\texttt {xindex-HAdW-eKO.lua} file|hyperpage}{10} -\indexentry{xindex-dtk.lua file@\texttt {xindex-dtk.lua} file|hyperpage}{12} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{13} -\indexentry{xindex program@\texttt {xindex} program|hyperpage}{14} -\indexentry{xindex-cfg-common.lua file@\texttt {xindex-cfg-common.lua} file|hyperpage}{14} -\indexentry{xindex package@\texttt {xindex} package|hyperpage}{15} -\end{filecontents} -%StartVisiblePreamble -\usepackage{makeidx} -\usepackage{hyperref} -%StopVisiblePreamble -\pagestyle{empty} -\begin{document} -foo\newpage -\printindex -\end{document} -\end{externalDocument} - - \section{Automatic index creation} diff --git a/Master/texmf-dist/scripts/xindex/xindex.lua b/Master/texmf-dist/scripts/xindex/xindex.lua index 984187bf381..72ee4a48e1d 100755 --- a/Master/texmf-dist/scripts/xindex/xindex.lua +++ b/Master/texmf-dist/scripts/xindex/xindex.lua @@ -6,11 +6,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL 1.3 -- --- $Id: xindex.lua 21 2022-01-27 17:45:10Z hvoss $ +-- $Id: xindex.lua 22 2022-02-11 12:18:15Z hvoss $ ----------------------------------------------------------------------- xindex = xindex or { } - local version = 0.36 + local version = 0.40 xindex.version = version --xindex.self = "xindex" @@ -49,8 +49,10 @@ local args = require ('xindex-lapp') [[ -n,--noheadings -a,--no_casesensitive -b,--no_labels + -i,--ignoreSpace -o,--output (default "") - -l,--language (default en) + -k --checklang same as * star for checking aux file + -l,--language (default en) or * for detecting the language from the aux file -p,--prefix (default L) -u,--use_UCA -s,--use_stdin @@ -97,7 +99,9 @@ require('xindex-baselib') local nInFiles = #args.files if not useStdInput then - --print(tostring(nInFiles).." input files are given!") + if vlevel == 3 then + print(tostring(nInFiles).." input file(s): ") + end inFiles = {} --args.files as strings for i = 1,nInFiles do local file = args.files_name[i] @@ -108,6 +112,9 @@ if not useStdInput then else inFiles[#inFiles+1] = file end + if vlevel == 3 then + print(file) + end end end @@ -153,7 +160,7 @@ require('xindex-lib') writeLog(2,"xindex v."..version.." (c) Herbert Voß\n",-1) writeLog(1,"Verbose level = "..vlevel.."\n",1) -writeLog(2,"Logfile:"..logfilename,1) +writeLog(2,"Logfile:"..logfilename.."\n",1) writeLog(2,"Open outputfile "..outfilename,0) outFile = io.open(outfilename,"w+") @@ -172,6 +179,13 @@ end -- writeLog(2,"Using input file: "..inFile.."\n",0) +if args["ignoreSpace"] then + ignoreSpace = args["ignoreSpace"] +else + ignoreSpace = false +end +writeLog(2,"ignore space for sorting: "..tostring(ignoreSpace).."\n",-1) + labelPrefix = args.prefix writeLog(2,"Label prefix: "..labelPrefix.."\n",-1) @@ -208,9 +222,57 @@ escape_chars = { -- by default " is the escape char -- esc_char..'%( is not needed because it can only appear after | -language = "en" -- default language +outFile = io.open(outfilename,"w+") + +local aux_language = "" + +if args["checklang"] or (args["language"] == "*") then + writeLog(2,'Check language in aux file\n',0) + -- \babel@aux{german}{} package babel + -- \selectlanguage *[variant=german,spelling=new,]{german} package polyglossia + local auxfile = inFiles[1]:split(".")[1]..".aux" + writeLog(2,auxfile.."\n",0) + local auxlines = read_lines_from(auxfile) + for line = 1,#auxlines do + local str = auxlines[line] + if string.find(str, "selectlanguage") then + str = str:match("{..+}$") -- get last word {language} + aux_language = str:sub(2,(#str-1)) + break + else + if string.find(str, "babel@aux{") then + -- print("Babel defunden: "..str) + str = str:match("{..+}$") -- get last word {language} + -- print("Babel: "..str) + aux_language = str:sub(2,(#str-3)) + break + end + end + end +-- print(aux_language) + if #aux_language > 0 then +-- print("find language") + for i,lang in pairs(indexheader) do + for j = 3,#lang do + if lang[j] == aux_language then + language = i + end + end + end + else + language = "en" + end + print("Detected language: "..language) +else + if args["language"] then + language = string.lower(args["language"]):sub(1, 2) + else + language = "en" + end +end + +--print("Sprache:"..language) -language = string.lower(args["language"]):sub(1, 2) writeLog(2,"Language = "..language.."\n",1) if (indexheader[language] == nil) then writeLog(2,'Corrected the unknown language "'..language..'" to "en"'.."\n",0) diff --git a/Master/texmf-dist/tex/latex/xindex/xindex.sty b/Master/texmf-dist/tex/latex/xindex/xindex.sty index 65799577dc9..0330eee8e39 100644 --- a/Master/texmf-dist/tex/latex/xindex/xindex.sty +++ b/Master/texmf-dist/tex/latex/xindex/xindex.sty @@ -1,6 +1,6 @@ %% This is file `xindex.sty', %% -%% Copyright (C) 2019- +%% Copyright (C) 2018-2021 %% Herbert Voss %% %% It may be distributed and/or modified under the diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua index b1adc53813b..fd484a7d605 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-AU'] = { - version = 0.33, + version = 0.40, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua index 35ec8ab4625..a619a749690 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-DIN2'] = { - version = 0.33, + version = 0.35, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua index 2244992db41..ac152ba7f97 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua @@ -5,13 +5,13 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-HAdW-eKO.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-HAdW-eKO.lua 13 2021-08-15 10:49:40Z hvoss $ ----------------------------------------------------------------------- -- -- configuration for index files of the Heidelberger Akademie der Wissenschaften if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = { - version = 0.35, + version = 0.34, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua index 20fa9a494d7..e7c16becf15 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua @@ -5,10 +5,10 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-base.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-base.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- -local info = { version = 0.35 } +local info = { version = 0.40 } -- check config if pageNoPrefixDel ~= "" then @@ -293,7 +293,7 @@ for k=1,#NewIndex do end indLines = indLines + 1 end - end + end -- not no_headings oldChar = currentChar end if specialItemOutput then diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua index 0ff33a591e1..4e5c09a87de 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-baselib.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-baselib.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-baselib'] = { - version = 0.35, + version = 0.40, comment = "base library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -128,12 +128,36 @@ function romanToNumber(s) return ret end +function toNumber(s) -- number as string or a roman number to arabic number + if s == nil then return s end + if type(s) == "number" then return s end -- it is already a number + local rnum = romanToNumber(s) -- check if roman + if rnum then return rnum end -- if yes, return converted roman + return tonumber(s) -- return string to number +end + +--[[ function string:split() local sep, fields = " ", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end +]] + +function string:split(s) + local D + if not s then + D = '%s' + else + D = tostring(s) + end + local sep, fields = " ", {} + local pattern = string.format("([^"..D.."]+)", sep) + self:gsub(pattern, function(c) fields[#fields+1] = c end) + return fields +end + function shellsort(a) local inc = math.ceil( #a / 2 ) diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua index 21267039d5e..270d5d5c3c4 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-cfg-common.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-cfg-common.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-common'] = { - version = 0.35, + version = 0.40, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -17,17 +17,66 @@ if not modules then modules = { } end modules ['xindex-cfg-common'] = { } indexheader = { - cs = {"Symboly", "Čísla"}, - da = {"Symboler", "Tal"}, - de = {"Symbole", "Zahlen"}, - en = {"Symbols", "Numbers"}, - es = {"Símbolos", "Números"}, - fr = {"Symboles","Nombres"}, - it = {"Simboli", "Numeri"}, - jp = {"シンボル","番号"}, - no = {"Symboler","Tall"}, + cs = {"Symboly", "Čísla", "czech"}, + da = {"Symboler", "Tal", "danish"}, + de = {"Symbole", "Zahlen", "austrian", "german", "germanb", "ngerman", "naustrian"}, + en = {"Symbols", "Numbers", "english", "USenglish", "american", "UKenglish", "british", "canadian", "australian", "newzealand"}, + es = {"Símbolos", "Números", "spanish"}, + fr = {"Symboles","Nombres", "french", "francais", "canadien", "acadian"}, + it = {"Simboli", "Numeri", "italian"}, + jp = {"シンボル","番号", "japanese"}, + nl = {"Symbolen", "Nummers", "dutch"}, + no = {"Symboler","Tall", "norsk", "nynorsk"}, } +--[[ babel +afrikaans +azerbaijani +basque +breton +bulgarian +catalan +croatian +czech +danish +dutch +english, USenglish, american, UKenglish, british, canadian, australian, newzealand +esperanto +estonian +finnish +french, francais, canadien, acadian +galician +austrian, german, germanb, ngerman, naustrian +greek, polutonikogreek +hebrew +icelandic +indonesian (bahasa, indon, bahasai) +interlingua +irish +italian +latin +lowersorbian +malay, melayu (bahasam) +samin +norsk, nynorsk +polish +portuguese +brazilian (portuges, brazil) +romanian +russian +scottish +spanish +slovak +slovene +swedish +serbian +turkish +ukrainian +uppersorbian +welsh +]] + + folium = { cs = {"f.", "ff."}, da = {"f", "ff"}, @@ -37,6 +86,7 @@ folium = { fr = {"\\,sq.","\\,sqq."}, it = {"f", "ff"}, jp = {"シンボル","番号"}, + nl = {"f.", "ff."}, no = {"\\,f.","\\,ff."}, } diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua index 098e314e3e9..cd5b5dbb128 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-cfg-uca.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-cfg-uca.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-lua'] = { - version = 0.35, + version = 0.40, comment = "configuration to xindex-cfg-uca.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua index 0adba23737f..1ee09e57dc3 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-cfg.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-cfg.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.35, + version = 0.40, comment = "main configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua index c39f92d652c..246f8776231 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.36, + version = 0.40, comment = "configuration file for the DANTE Edition", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua index 945094663f5..d4e10b75da8 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-dtk.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-dtk.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.35, + version = 0.40, comment = "DTK configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua index dedf476ac2c..61c4f90d9d0 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-lib.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-lib.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-lib'] = { - version = 0.35, + version = 0.40, comment = "main library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -311,8 +311,8 @@ function compressEntryList(EntryList) end end -- last data line - newList[#newList]["pages"] = deletePageDups(newList[#newList]["pages"]) -- require 'xindex-pretty'.dump(newList) -- only for internal dump + newList[#newList]["pages"] = deletePageDups(newList[#newList]["pages"]) return newList end @@ -354,14 +354,14 @@ end function compressPageList(pages) -- called with (v["pages"]) writeLog(1,"compressPageList: we have "..#pages.." pages for this entry\n",2) -- require 'xindex-pretty'.dump(pages) -- only for internal dump - pages = deletePageDups(pages) -- delete duplicate page numners with same special + pages = deletePageDups(pages) -- delete duplicate page numbers with same special local str if #pages == 1 then -- only one pageno return pages end -- only one pageno if #pages == 2 then -- only two pages - if tonumber(pages[1]["number"]) and tonumber(pages[2]["number"]) then - if ((tonumber(pages[2]["number"]) - tonumber(pages[1]["number"])) == 1) and (pages[1]["special"] == pages[2]["special"]) then + if toNumber(pages[1]["number"]) and toNumber(pages[2]["number"]) then + if ((toNumber(pages[2]["number"]) - toNumber(pages[1]["number"])) == 1) and (pages[1]["special"] == pages[2]["special"]) then if fCompress then pages[1]["number"] = pages[1]["number"]..page_folium[1] pages[2] = nil @@ -392,8 +392,8 @@ function compressPageList(pages) -- called with (v["pages"]) end if args_v then print ("compressPageList: more than two pages for the entry\n") end for i=startIndex,#pages do - if tonumber(pages[i-1]["number"]) and tonumber(pages[i]["number"]) then -- de we have something like 17--31 in the current list - if ((tonumber(pages[i]["number"])-tonumber(pages[i-1]["number"])) == 1) and + if (toNumber(pages[i-1]["number"]) and toNumber(pages[i]["number"])) then -- do we have two arabic or two roman numbers? + if ((toNumber(pages[i]["number"])-toNumber(pages[i-1]["number"])) == 1) and (pages[i]["special"] == pages[i-1]["special"]) then -- something like 12, 13 with identical |\special series[#series+1] = pages[i]-- page difference is 1, add page to series elseif (#series == 1) then -- no -f page -> only one page -> output @@ -529,10 +529,18 @@ function GenerateSortKey(a) end if no_caseSensitive then A = NormalizedUpper(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!',' ')) -- replace! by empty - a["SortKey"] = A + if ignoreSpace then + a["SortKey"] = A:gsub("%s+", "") -- remove spaces + else + a["SortKey"] = A + end else A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!',' ')) -- replace! by empty - a["SortKey"] = A + if ignoreSpace then + a["SortKey"] = A:gsub("%s+", "")-- remove spaces + else + a["SortKey"] = A + end end -- return A end @@ -754,12 +762,12 @@ end function itemOutput(last, v, hyperpage) local lastItems = last --- print (tostring("test: "),v["Entry"],lastItems[1],lastItems[2],lastItems[3],type(lastItems[1]),#lastItems) + --print (tostring("test: "),v["Entry"],lastItems[1],lastItems[2],lastItems[3],type(lastItems[1]),#lastItems) local currentItems = {} local Entry = v["Entry"] local mainEntry = getItem(Entry,0) -- save current main letter local lastmainEntry = last[1] -- save last main letter --- require 'xindex-pretty'.dump(v) -- only for internal dump + --require 'xindex-pretty'.dump(v) -- only for internal dump local str local excl = select(2,string.gsub(Entry,"!","!")) -- Number of ! writeLog(1,"itemOutput(): We have entry "..Entry.."\n",2) diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua index 6d6853dd03b..9e02d3018c0 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua @@ -6,11 +6,11 @@ -- MODIFIED: Sveinung Heggen (2020-01-02) -- LICENSE: LPPL1.3 -- --- $Id: xindex-norsk.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-norsk.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-no'] = { - version = 0.35, + version = 0.40, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua index 80699a0313b..e626c1225be 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua @@ -3,11 +3,11 @@ -- Also provides a sandboxed Lua table reader and -- a function to present large numbers in human-friendly format. -- --- $Id: xindex-pretty.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-pretty.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-pretty'] = { - version = 0.35, + version = 0.40, comment = "dump a Lua table for debugging", author = "Steve Donovan", copyright = "Steve Donovan", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua index 93757ea4132..dceb9bf3cd9 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua @@ -5,11 +5,11 @@ -- AUTHOR: Herbert Voß -- LICENSE: LPPL1.3 -- --- $Id: xindex-yannis.lua 19 2022-01-22 09:59:15Z hvoss $ +-- $Id: xindex-yannis.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-yannis'] = { - version = 0.35, + version = 0.40, comment = "main configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", |