summaryrefslogtreecommitdiff
path: root/indexing
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-04 03:02:40 +0000
committerNorbert Preining <norbert@preining.info>2020-06-04 03:02:40 +0000
commit6c90555ebb89f41cc4dfb6cf3ee6bfaa8107650e (patch)
treed3475ab1d6bd6675a0975dfa6059602be057f0d5 /indexing
parent44fde4a143b75ae4f383b05832343d497c254989 (diff)
CTAN sync 202006040302
Diffstat (limited to 'indexing')
-rw-r--r--indexing/xindex/CHANGELOG1
-rw-r--r--indexing/xindex/README.md8
-rw-r--r--indexing/xindex/doc/Makefile7
-rw-r--r--indexing/xindex/doc/tests/HADW.pdfbin18842 -> 18924 bytes
-rw-r--r--indexing/xindex/doc/tests/HADW.tex7
-rw-r--r--indexing/xindex/doc/tests/HADW2.ind70
-rw-r--r--indexing/xindex/doc/tests/Umlaute.pdfbin15834 -> 15832 bytes
-rw-r--r--indexing/xindex/doc/tests/Umlaute2.pdfbin19743 -> 19533 bytes
-rw-r--r--indexing/xindex/doc/tests/buch.ind3
-rw-r--r--indexing/xindex/doc/tests/buch.pdfbin40385 -> 40170 bytes
-rw-r--r--indexing/xindex/doc/tests/demo-hyperref.pdfbin29388 -> 29389 bytes
-rw-r--r--indexing/xindex/doc/tests/demo.pdfbin35457 -> 35447 bytes
-rw-r--r--indexing/xindex/doc/tests/demo3.pdfbin9503 -> 9494 bytes
-rwxr-xr-xindexing/xindex/doc/tests/runTests.sh4
-rw-r--r--indexing/xindex/doc/xindex-doc.pdfbin377997 -> 393329 bytes
-rw-r--r--indexing/xindex/doc/xindex-doc.tex69
-rw-r--r--indexing/xindex/lualatex/xindex-DIN2.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-HAdW-eKO.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-base.lua17
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-common.lua6
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-uca.lua17
-rw-r--r--indexing/xindex/lualatex/xindex-cfg.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-dtk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lapp.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lib.lua88
-rw-r--r--indexing/xindex/lualatex/xindex-norsk.lua155
-rw-r--r--indexing/xindex/lualatex/xindex-pretty.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-yannis.lua260
-rwxr-xr-xindexing/xindex/scripts/xindex.lua38
29 files changed, 509 insertions, 253 deletions
diff --git a/indexing/xindex/CHANGELOG b/indexing/xindex/CHANGELOG
index 5278afea3b..71e72113cb 100644
--- a/indexing/xindex/CHANGELOG
+++ b/indexing/xindex/CHANGELOG
@@ -1,3 +1,4 @@
+0.23 2020-06-02 - added support for the package LUA-UCA (Unicode Collation Algorithm)
0.22 2020-05-30 - added test for correct language with a fallback to english (en)
and also allow de_DE, where only the first two letters are used
0.21 2020-05-29 - added support for italian language
diff --git a/indexing/xindex/README.md b/indexing/xindex/README.md
index c435629199..70f0bd970d 100644
--- a/indexing/xindex/README.md
+++ b/indexing/xindex/README.md
@@ -7,6 +7,7 @@ will be included in at least LuaTeX 1.09 (TeXLive 2019)
* xindex.lua -- main file
* xindex-cfg.lua -- config module
* xindex-cfg-common.lua -- main config module
+* xindex-cfg-uca.lua -- config module for uca
* xindex-base.lua -- base file
* xindex-lib.lua -- functions module
* xindex-lapp.lua -- read parameter
@@ -17,15 +18,17 @@ The syntax of `xindex`
xindex [options] <inputfile>[.idx]
possible options are (short,long):
-
-q,--quiet
-h,--help
- -v
+ -v... Verbosity level; can be -v, -vv, -vvv
-c,--config (default cfg)
-e,--escapechar (default ")
-n,--noheadings
+ -a,--no_casesensitive
-o,--output (default "")
-l,--language (default en)
+ -p,--prefix (default L)
+ -u,--use_UCA
<input> (string)
Testfiles:
@@ -42,4 +45,3 @@ buch.tex: run
./xindex.lua buch.idx
lualatex buch
-
diff --git a/indexing/xindex/doc/Makefile b/indexing/xindex/doc/Makefile
index d0e8fd6fd7..7e5529f499 100644
--- a/indexing/xindex/doc/Makefile
+++ b/indexing/xindex/doc/Makefile
@@ -1,8 +1,7 @@
-# `Makefile' for `pst-grad.pdf', hv, 2008/08/11
.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps
-PACKAGE = xhfill
+PACKAGE = xindex
MAIN = xindex-doc
@@ -21,13 +20,13 @@ doc:
# if ! test -f $(MAIN).glo ; then touch $(MAIN).glo; fi
if ! test -f $(MAIN).idx ; then touch $(MAIN).idx; fi
# makeindex -s gglo.ist -t $(MAIN).glg -o $(MAIN).gls $(MAIN).glo
- xindex $(MAIN).idx
+ xindex -a $(MAIN).idx
# bibtex $(MAIN)
$(LATEX) --shell-escape $(MAIN)
# $(LATEX) --shell-escape $(MAIN)
clean :
- $(RM) *.dvi *.aux *.log *.xml xindex-?.tex xindex-??.tex *.ind *.idx *.toc *.out *.ilg *.adx
+ $(RM) *.dvi *.aux *.log *.xml xindex-?.tex xindex-??.tex *.ind *.idx *.toc *.out *.ilg
veryclean : clean
$(RM) *.pdf
diff --git a/indexing/xindex/doc/tests/HADW.pdf b/indexing/xindex/doc/tests/HADW.pdf
index 2c52208cf4..239f431bc9 100644
--- a/indexing/xindex/doc/tests/HADW.pdf
+++ b/indexing/xindex/doc/tests/HADW.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/HADW.tex b/indexing/xindex/doc/tests/HADW.tex
index 99c2c17759..1a837fd93b 100644
--- a/indexing/xindex/doc/tests/HADW.tex
+++ b/indexing/xindex/doc/tests/HADW.tex
@@ -1,10 +1,11 @@
\documentclass[paper=a4,parskip=half-,ngerman,DIV=13]{scrartcl}
\usepackage{eurosym}
\usepackage[silent]{fontspec}
-\usepackage[nomath]{libertinus-otf}
+\usepackage{libertinus-otf}
\usepackage{babel}
\usepackage{makeidx}
-\usepackage{dtk-logos,xcolor}
+\usepackage{dtk-logos}
+\usepackage[table]{xcolor}
\makeatletter
\def\theindex{% only for demonstration
\section*{\indexname}
@@ -13,7 +14,7 @@
\makeatother
\begin{document}
-Run with \verb|xindex --config HAdW|
+Run with \verb|xindex --config HAdW-eKO|
\printindex
\end{document}
diff --git a/indexing/xindex/doc/tests/HADW2.ind b/indexing/xindex/doc/tests/HADW2.ind
index d5ba7965fb..04ba01c38b 100644
--- a/indexing/xindex/doc/tests/HADW2.ind
+++ b/indexing/xindex/doc/tests/HADW2.ind
@@ -2,63 +2,67 @@
\begin{theindex}
\indexspace
-\textbf{A}\label{L-xindex-A}
+\textbf{K}
\nopagebreak[4]
- \item Aachen, Johannes von \dotfill {\colorbox{black!15}{VII/1}:~215}
- \item Aarones \dotfill {\colorbox{black!15}{VII/2/1}:~1003}, {1012}
- \item Abrahamson \dotfill {\colorbox{black!15}{VII/2/1}:~864}, {991}, {1048}, {1067}, {1156}
- \item Adamson \dotfill {\colorbox{black!15}{VII/2/1}:~1223}, {\colorbox{black!15}{IX/1}:~1228}
+ \item Karl II, {VII/1 147}
+ \item Karl III, {VII/1 149}
+ \item Karl IV, {VII/1 147}, {34}
+ \item Karl V, {VII/1 34}
+ \item Karl VI, {VII/1 296}
+ \item Karl IX, {VII/1 296}
+ \item Karl X, {VII/1 149}
+
+\indexspace
+\textbf{A}
+\nopagebreak[4]
+ \item Aachen, Johannes von, {VII/1 215}
+ \item Aarones, {VII/2/1 1003}, {1012}
+ \item Abrahamson, {VII/2/1 1048}, {1067}, {1156}, {864}, {991}
+ \item Adamson, {VII/2/1 1223}, {IX/1 1228}
\item Adrian
- \subitem -\,Hauster \dotfill {\colorbox{black!15}{VII/1}:~514}, {\colorbox{black!15}{XI/1}:~515}
+ \subitem -\,Hauster, {VII/1 514}, {XI/1 515}
\item Alting
- \subitem -\,Mensa \dotfill {\colorbox{black!15}{VII/1}:~426}, {434}, {453}, {455}, {466f.}
+ \subitem -\,Mensa, {VII/1 426}, {434}, {453}, {455}, {466f}
\indexspace
-\textbf{B}\label{L-xindex-B}
+\textbf{B}
\nopagebreak[4]
\item Bremen
- \subitem -\,Heinz von, Erzbischof \dotfill \see{Sachsen-Lauenburg}{ }
+ \subitem -\,Heinz von, Erzbischof, \see{Sachsen-Lauenburg}{}
\indexspace
-\textbf{J}\label{L-xindex-J}
+\textbf{J}
\nopagebreak[4]
\item Julian
- \subitem -\,Apostata, römischer Kaiser \dotfill {\colorbox{black!15}{VII/2/1}:~904}
- \item Justinian I., byzantinischer Kaiser \dotfill {\colorbox{black!15}{VII/1}:~326}, {734}, {\colorbox{black!15}{VII/2/1}:~1011}
+ \subitem -\,Apostata, römischer Kaiser, {VII/2/1 904}
+ \item Justinian I., byzantinischer Kaiser, {VII/1 326}, {734}, {VII/2/1 1011}
\indexspace
-\textbf{K}\label{L-xindex-K}
+\textbf{K}
\nopagebreak[4]
\item Karl
- \subitem -\,II., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~147}
- \subitem -\,III., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~149}
- \subitem -\,IV., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~147}, {147}
- \subitem -\,V., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~34}
- \subitem -\,VI., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~296}
- \subitem -\,IX., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~296}
- \subitem -\,X., Kaiser \dotfill {\colorbox{black!15}{VII/1}:~149}
- \item Karl II \dotfill {\colorbox{black!15}{VII/1}:~147}
- \item Karl III \dotfill {\colorbox{black!15}{VII/1}:~149}
- \item Karl IV \dotfill {\colorbox{black!15}{VII/1}:~147}, {147}
- \item Karl V \dotfill {\colorbox{black!15}{VII/1}:~34}
- \item Karl VI \dotfill {\colorbox{black!15}{VII/1}:~296}
- \item Karl IX \dotfill {\colorbox{black!15}{VII/1}:~296}
- \item Karl X \dotfill {\colorbox{black!15}{VII/1}:~149}
+ \subitem -\,II., Kaiser, {VII/1 147}
+ \subitem -\,III., Kaiser, {VII/1 149}
+ \subitem -\,IV., Kaiser, {VII/1 147}, {34}
+ \subitem -\,IX., Kaiser, {VII/1 296}
+ \subitem -\,V., Kaiser, {VII/1 34}
+ \subitem -\,VI., Kaiser, {VII/1 296}
+ \subitem -\,X., Kaiser, {VII/1 149}
\indexspace
-\textbf{O}\label{L-xindex-O}
+\textbf{O}
\nopagebreak[4]
\item Osnabrück
- \subitem -\,Heinz von, Bischof \dotfill \see{Sachsen-Lauenburg}{ }
+ \subitem -\,Heinz von, Bischof, \see{Sachsen-Lauenburg}{}
\indexspace
-\textbf{S}\label{L-xindex-S}
+\textbf{S}
\nopagebreak[4]
\item Schleswig-Holstein
- \subitem -\,Rudolf von, Herzog \dotfill {\colorbox{black!15}{VII/2/1}:~758--761}, {765}
+ \subitem -\,Rudolf von, Herzog, {VII/2/1 758--761}, {765}
\indexspace
-\textbf{Z}\label{L-xindex-Z}
+\textbf{Z}
\nopagebreak[4]
- \item Zwingl, Haldrich \dotfill {\colorbox{black!15}{IX}:~479}, {692}
+ \item Zwingl, Haldrich, {IX 479}, {692}
\end{theindex}
diff --git a/indexing/xindex/doc/tests/Umlaute.pdf b/indexing/xindex/doc/tests/Umlaute.pdf
index 1ec481723e..d91d9f10ec 100644
--- a/indexing/xindex/doc/tests/Umlaute.pdf
+++ b/indexing/xindex/doc/tests/Umlaute.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/Umlaute2.pdf b/indexing/xindex/doc/tests/Umlaute2.pdf
index eec5664265..c2b78f3f18 100644
--- a/indexing/xindex/doc/tests/Umlaute2.pdf
+++ b/indexing/xindex/doc/tests/Umlaute2.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/buch.ind b/indexing/xindex/doc/tests/buch.ind
index 0ce9931859..57a3d139cf 100644
--- a/indexing/xindex/doc/tests/buch.ind
+++ b/indexing/xindex/doc/tests/buch.ind
@@ -473,10 +473,11 @@
\subitem -\,Stil, {378}
\subitem -\,Tiefe, {64}
\subitem -\,Warnung, {883}
- \subitem -\,fett, {411}, {451}
\item Schriftattribut, {660}
\item Schrifteinbindung, {9}
\item Schriftfamilie, {85}, {442}, {595}
+ \item Schrift
+ \subitem -\,fett, {411}, {451}
\item Schriftgröße, {63}, {87}, {404}
\item Schriftkodierung, {9}, {54}, {70}
\item Schriftstärke, {87}
diff --git a/indexing/xindex/doc/tests/buch.pdf b/indexing/xindex/doc/tests/buch.pdf
index 9de350c28f..5975dd18f7 100644
--- a/indexing/xindex/doc/tests/buch.pdf
+++ b/indexing/xindex/doc/tests/buch.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/demo-hyperref.pdf b/indexing/xindex/doc/tests/demo-hyperref.pdf
index 77c6a61daa..dfe9b33aaa 100644
--- a/indexing/xindex/doc/tests/demo-hyperref.pdf
+++ b/indexing/xindex/doc/tests/demo-hyperref.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/demo.pdf b/indexing/xindex/doc/tests/demo.pdf
index 5ef1b4633a..0df7056864 100644
--- a/indexing/xindex/doc/tests/demo.pdf
+++ b/indexing/xindex/doc/tests/demo.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/demo3.pdf b/indexing/xindex/doc/tests/demo3.pdf
index 0d71e40873..b9718a4e31 100644
--- a/indexing/xindex/doc/tests/demo3.pdf
+++ b/indexing/xindex/doc/tests/demo3.pdf
Binary files differ
diff --git a/indexing/xindex/doc/tests/runTests.sh b/indexing/xindex/doc/tests/runTests.sh
index a762d96357..678bfa40e7 100755
--- a/indexing/xindex/doc/tests/runTests.sh
+++ b/indexing/xindex/doc/tests/runTests.sh
@@ -23,10 +23,6 @@ lualatex demo-hyperref > /dev/null
echo "HADW"
xindex -l de -c HAdW-eKO HADW > /dev/null
lualatex HADW > /dev/null
-lualatex HADW > /dev/null
-
-echo "HADW2"
-xindex -l de --config HAdW-eKO HADW2 > /dev/null
echo "Umlaute"
xindex -l de Umlaute > /dev/null
diff --git a/indexing/xindex/doc/xindex-doc.pdf b/indexing/xindex/doc/xindex-doc.pdf
index a5ce61fc03..ccd6f2d307 100644
--- a/indexing/xindex/doc/xindex-doc.pdf
+++ b/indexing/xindex/doc/xindex-doc.pdf
Binary files differ
diff --git a/indexing/xindex/doc/xindex-doc.tex b/indexing/xindex/doc/xindex-doc.tex
index 6502c3deac..050d21dca2 100644
--- a/indexing/xindex/doc/xindex-doc.tex
+++ b/indexing/xindex/doc/xindex-doc.tex
@@ -80,7 +80,7 @@
\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\xIndexVersion{#2}}
-\setVersion{version = 0.22}% can be automatically changed by perl
+\setVersion{version = 0.23}% can be automatically changed by perl
\setkeys{dtk}{cleanup=true,force=false}
@@ -94,6 +94,8 @@
\vfill
Thanks to: \\
Mark Baudoin;
+Denis Bitouzé;
+Michal Hoftich;
Heiko Oberdiek;
Matteo Paolini
@@ -162,6 +164,7 @@ xindex
[-o,--output ] default is <input>.ind
[-l,--language ] default is en
[-p,--prefix] default L
+ [-u,--use_UCA ] default is false
<input file>
\end{verbatim}
@@ -306,11 +309,13 @@ The predefined language is »en« and currently the following languages are poss
{\Japanese
\begin{Verbatim}[fontfamily=helvetica,commandchars=\\<>]
indexheader = {
+ cs = {"Symboly", "Čísla"},
+ da = {"Symboler", "Tal"},
de = {"Symbole", "Zahlen"},
en = {"Symbols", "Numbers"},
- fr = {"Symboles","Chiffre"},
+ fr = {"Symboles","Nombres"},
it = {"Simboli", "Numeri"},
-\Japanese jp = {"シンボル","番号"},
+ jp = {"シンボル","番号"},
}
\end{Verbatim}
}
@@ -325,7 +330,7 @@ The following example was run with \verb|xindex -l it <file>.idx|:
crop,
xindex,
xindexOptions=-l it -e ">",
- force=true,
+ force=false,
runs=2,code,docType=latex,
showFilename,
align=\centering,
@@ -358,7 +363,7 @@ Run \texttt{xindex} with \texttt{xindex -l it -e ">"}\index{123}
\section{Sorting}
-
+\subsection{Default sorting by a character table}
The default sorting is unicode aware and uses a translation table for accented characters:
\begin{verbatim}
@@ -624,6 +629,54 @@ The following runs with \verb|xindex -l jp <file>|:
\end{externalDocument}
\end{minipage}
+\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.
+
+
+\begin{externalDocument}[
+% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
+ mpwidth=0.55\linewidth,
+% pages={6},
+ frame=false,
+ compiler=lualatex,
+ crop,
+ xindex,
+ xindexOptions=-u -l cs,
+ force=true,
+ runs=2,code,docType=latex,
+ showFilename,
+ align=\centering,
+ lstOptions={columns=fixed}]{xindex}
+\documentclass[paper=a6]{scrartcl}
+\makeatletter
+\def\theindex{% only for demonstration
+ \section*{\indexname}
+ \parskip\z@ \@plus .3\p@\relax \parindent\z@
+ \let\item\@idxitem}
+\makeatother
+%StartVisiblePreamble
+\usepackage{multicol}
+\usepackage{makeidx}\makeindex
+\def\Index#1{#1\index{#1}}
+%StopVisiblePreamble
+\pagestyle{empty}
+\begin{document}
+Sorted with \verb|-u -l cs|
+\Index{ahoj} \Index{crha}, \Index{čaj}, \Index{chachar},
+\Index{rak}, \Index{řeka}, \Index{srp}, \Index{šutr},
+\Index{hudba}, \Index{linux}, \Index{zebra},
+\Index{žába}, \Index{7 dubů}
+\begin{multicols}{2} \printindex \end{multicols}
+\end{document}
+\end{externalDocument}
+
+The sorting order can be easliy modified. Read the documentation of the package \texttt{LUA-UCA}
+on how to do it and what languages are supported so far. Any additional code setting for
+UCA should be dont in the file \Lfile{xindex-cfg-uca.lua}, which will automatically be read
+by \Lprog{xindex}.
+
+
%\clearpage
@@ -643,12 +696,14 @@ file \Lfile{xindex-cfg-common.cfg}:
\small
\begin{Verbatim}[fontfamily=helvetica]
folium = {
+ cs = {"f.", "ff."},
+ da = {"f", "ff"},
de = {"f", "ff"},
en = {"f", "ff"},
- fr = {"\,sq","\,sqq"},
+ fr = {"\\,sq","\\,sqq"},
it = {"f", "ff"},
- no = {"\\,f.","\\,ff."},
jp = {"シンボル","番号"},
+ no = {"\\,f.","\\,ff."},
}
\end{Verbatim}
}
diff --git a/indexing/xindex/lualatex/xindex-DIN2.lua b/indexing/xindex/lualatex/xindex-DIN2.lua
index 35eae4f069..6b925e3367 100644
--- a/indexing/xindex/lualatex/xindex-DIN2.lua
+++ b/indexing/xindex/lualatex/xindex-DIN2.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
index 5f1c8c8344..9b440fa94d 100644
--- a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
+++ b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
@@ -9,7 +9,7 @@
-- configuration for index files of the Heidelberger Akademie der Wissenschaften
if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = {
- version = 0.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-base.lua b/indexing/xindex/lualatex/xindex-base.lua
index 9d36d5ddd2..6c51f21763 100644
--- a/indexing/xindex/lualatex/xindex-base.lua
+++ b/indexing/xindex/lualatex/xindex-base.lua
@@ -6,7 +6,7 @@
-- LICENSE: LPPL1.3
-----------------------------------------------------------------------
-local info = { version = 0.22 }
+local info = { version = 0.23 }
-- check config
if pageNoPrefixDel ~= "" then
@@ -120,6 +120,21 @@ for i, str0 in ipairs(escape_chars) do
end
]] -- no more needed, we redo the setting
+if use_UCA then
+ for i=1, #NewIndex do
+ v = NewIndex[i]
+ -- the collator:get_lowest_char will return character on the given
+ -- position. It will be lowercase and without accents.
+ local codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.SortKey))
+ v.sortChar = getSortChar(codepoints) --or getSortChar(collator_obj:string_to_codepoints(NormalizedUpper(v.Entry)))
+ if not v.sortChar then
+ -- alternativelly use v.Entry if SortKey doesn't contain usable string
+ codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.Entry))
+ v.sortChar = getSortChar(codepoints)
+ end
+ end
+end
+
if SORTendhook then
NewIndex = SORTendhook(NewIndex)
end
diff --git a/indexing/xindex/lualatex/xindex-cfg-common.lua b/indexing/xindex/lualatex/xindex-cfg-common.lua
index a49723ebf2..85f2c033b8 100644
--- a/indexing/xindex/lualatex/xindex-cfg-common.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-common.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-common'] = {
- version = 0.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -16,15 +16,17 @@ if not modules then modules = { } end modules ['xindex-cfg-common'] = {
indexheader = {
cs = {"Symboly", "Čísla"},
+ da = {"Symboler", "Tal"},
de = {"Symbole", "Zahlen"},
en = {"Symbols", "Numbers"},
- fr = {"Symboles","Chiffre"},
+ fr = {"Symboles","Nombres"},
it = {"Simboli", "Numeri"},
jp = {"シンボル","番号"},
}
folium = {
cs = {"f.", "ff."},
+ da = {"f", "ff"},
de = {"f", "ff"},
en = {"f", "ff"},
fr = {"\\,sq","\\,sqq"},
diff --git a/indexing/xindex/lualatex/xindex-cfg-uca.lua b/indexing/xindex/lualatex/xindex-cfg-uca.lua
new file mode 100644
index 0000000000..42ad4ec6dd
--- /dev/null
+++ b/indexing/xindex/lualatex/xindex-cfg-uca.lua
@@ -0,0 +1,17 @@
+-----------------------------------------------------------------------
+-- FILE: xindex-cfg-uca.lua
+-- DESCRIPTION: configuration file for lua-uca
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+-----------------------------------------------------------------------
+
+if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
+ version = 0.23,
+ comment = "configuration to xindex-cfg-uca.lua",
+ author = "Herbert Voss",
+ copyright = "Herbert Voss",
+ license = "LPPL 1.3"
+}
+
+-- put any additional code for lua-uca here ---
diff --git a/indexing/xindex/lualatex/xindex-cfg.lua b/indexing/xindex/lualatex/xindex-cfg.lua
index 9e1f12b6a2..7b23b7c905 100644
--- a/indexing/xindex/lualatex/xindex-cfg.lua
+++ b/indexing/xindex/lualatex/xindex-cfg.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-dtk.lua b/indexing/xindex/lualatex/xindex-dtk.lua
index a195ccde02..6a32d5e863 100644
--- a/indexing/xindex/lualatex/xindex-dtk.lua
+++ b/indexing/xindex/lualatex/xindex-dtk.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "DTK configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-lapp.lua b/indexing/xindex/lualatex/xindex-lapp.lua
index b55cb170f8..94c22cb240 100644
--- a/indexing/xindex/lualatex/xindex-lapp.lua
+++ b/indexing/xindex/lualatex/xindex-lapp.lua
@@ -28,7 +28,7 @@
--~ n 2
--------------------------------
if not modules then modules = { } end modules ['xindex-lapp'] = {
- version = 0.22,
+ version = 0.23,
comment = "read parameter for xindex.lua",
author = "Steve Donovan",
copyright = "Steve Donovan",
diff --git a/indexing/xindex/lualatex/xindex-lib.lua b/indexing/xindex/lualatex/xindex-lib.lua
index 8e480866c8..720d473d53 100644
--- a/indexing/xindex/lualatex/xindex-lib.lua
+++ b/indexing/xindex/lualatex/xindex-lib.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.22,
+ version = 0.23,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -569,43 +569,15 @@ function GenerateSortKeys(Index)
end
end
-function UTFCompare(a,b)
--- a, b are something like \indexentry{foo}{bar}
--- writeLog(1,"UTFCompare: "..a["Entry"]..", "..a["pages"][1]["number"].." - "..b["Entry"]..", "..b["pages"][1]["number"].."\n",2)
--- k = k + 1
--- if (k % 50) == 0 then writeLog(1,".",1) end
-
+function UTFCompare(a,b)
local A = a["SortKey"]
local B = b["SortKey"]
-
writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2)
--- print(A,B)
---[[
- if A == B then -- same entry, use also page number
- Apage = string.format("%09s",a["pages"][1]["number"])
- Bpage = string.format("%09s",b["pages"][1]["number"])
- A = string.format("%-90s",A)..Apage
- B = string.format("%-90s",B)..Bpage
- end
- if numericPage then
- if tonumber(a["pages"][1]["number"]) then
- Apage = string.format("%09d",a["pages"][1]["number"])
- else
- Apage = string.format("%09d",romanToNumber(a["pages"][1]["number"]))
- end
- if tonumber(b["pages"][1]["number"]) then
- Bpage = string.format("%09d",b["pages"][1]["number"])
- else
- Bpage = string.format("%09d",romanToNumber(b["pages"][1]["number"]))
- end
+ if use_UCA then
+ return collator_obj:compare_strings(A,B)
else
- Apage = string.format("%09s",a["pages"][1]["number"])
- Bpage = string.format("%09s",b["pages"][1]["number"])
+ return A<B
end
- A = string.format("%-90s",A)..Apage
- B = string.format("%-90s",B)..Bpage
-]]
- return A < B
end
function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}}
@@ -1012,3 +984,53 @@ function stripLeadingSpaces(str)
end
+-- get Unicode category of the codepoint, if supported
+function getCategory(codepoints)
+ local codepoint = codepoints[1]
+ local category = get_category(codepoint)
+ if category == "Nd" then
+ return "digits"
+ elseif category:match("^L") then
+ local block = binary_range_search(codepoint, unicode_blocks) or {}
+ return block[3] or "other"
+ end
+ return "other"
+end
+
+-- insert the index entry to the categories subtable
+function categorize(codepoints, entry, categories)
+ local subcategories = categories.categories
+ -- return category name from the Unicode block of the first character
+ local category = getCategory(codepoints)
+ -- if the categories doesn't use this code block, categorize it as other
+ local used = subcategories[category] and category or "other"
+ table.insert(subcategories[used], entry)
+end
+
+-- convert categories back to index list
+function uncategorize(ordering_categories)
+ local newlist = {}
+ -- make new index order based on defined categories
+ for _, category in ipairs(ordering_categories.order) do
+ for _,entry in ipairs(ordering_categories.categories[category]) do
+ newlist[#newlist+1] = entry
+ end
+ end
+ return newlist
+end
+
+function getSortChar(codepoints)
+ if #codepoints > 0 then
+ local codes, pos = collator_obj:get_lowest_char(codepoints, 1)
+ if not codes then
+ -- if the first character in the sort key doesn't return letter
+ -- continue until we find some
+ table.remove(codepoints, 1)
+ return getSortChar(codepoints)
+ end
+ local sort_char = utf8.char(table.unpack(codes))
+ -- print unicode category of the first char
+ return upper(sort_char) -- use unicode.utf8.upper to make the char uppercase
+ end
+end
+
diff --git a/indexing/xindex/lualatex/xindex-norsk.lua b/indexing/xindex/lualatex/xindex-norsk.lua
deleted file mode 100644
index 7473b42ed6..0000000000
--- a/indexing/xindex/lualatex/xindex-norsk.lua
+++ /dev/null
@@ -1,155 +0,0 @@
------------------------------------------------------------------------
--- FILE: xindex-norsk.lua
--- DESCRIPTION: configuration file for xindex.lua
--- REQUIREMENTS:
--- AUTHOR: Herbert Voß
--- MODIFIED: Sveinung Heggen (2020-01-02)
--- LICENSE: LPPL1.3
------------------------------------------------------------------------
-
-if not modules then modules = { } end modules ['xindex-norsk'] = {
- version = 0.22,
- comment = "configuration to xindex.lua",
- author = "Herbert Voss",
- copyright = "Herbert Voss",
- license = "LPPL 1.3"
-}
-
-local ducet = require "lua-uca.lua-uca-ducet"
-local collator = require "lua-uca.lua-uca-collator"
-local languages = require "lua-uca.lua-uca-languages"
-local collator_obj = collator.new(ducet)
-
-local language = "en" -- default language
--- language name specified on the command line doesn't seem to be available
--- in the config file, so we just try to find it ourselves
-for i, a in ipairs(arg) do
- if a == "-l" or a=="--language" then
- language = arg[i+1]
- break
- end
-end
-
-if languages[language] then
- print("[Lua-UCA] Loading language: " .. language)
- collator_obj = languages[language](collator_obj)
-end
-
-local upper = unicode.utf8.upper
-
-escape_chars = { -- by default " is the escape char
- {'""', "\\escapedquote", '\"{}' },
- {'"@', "\\escapedat", "@" },
- {'"|', "\\escapedvert", "|" },
- {'"!', "\\escapedexcl", "!" },
- {'"(', "\\escapedparenleft", "(" },
- {'")', "\\escapedparenright", ")" }
-}
-
-itemPageDelimiter = "," -- Hello, 14
-compressPages = true -- something like 12--15, instead of 12,13,14,15. the |( ... |) syntax is still valid
-fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5
-minCompress = 3 -- 14--17 or
-numericPage = true -- for non-numerical page numbers, like "VI-17"
-sublabels = {"", "---\\,", "--\\,", "-\\,"} -- for the (sub(sub(sub-items first one is for item
-pageNoPrefixDel = "" -- a delimiter for page numbers like "VI-17"
-indexOpening = "" -- commands after \begin{theindex}
-rangeSymbol = "--"
-idxnewletter = "\\textbf" -- Only valid if -n is not set
-
-folium = {
- de = {"f.", "ff."},
- en = {"f.", "ff."},
- fr = {"\\,sq","\\,sqq"},
- no = {"\\,f.","\\,ff."},
- cs = {"f.", "ff."},
-}
-
-indexheader = {
- de = {"Symbole", "Zahlen"},
- en = {"Symbols", "Numbers"},
- fr = {"Symboles","Chiffre"},
- jp = {"シンボル","番号"},
- cs = {"Symboly", "Čísla"}
-}
-
-
--- get Unicode category of the codepoint, if supported
-function getCategory(codepoints)
- local codepoint = codepoints[1]
- local category = get_category(codepoint)
- if category == "Nd" then
- return "digits"
- elseif category:match("^L") then
- local block = binary_range_search(codepoint, unicode_blocks) or {}
- return block[3] or "other"
- end
- return "other"
-end
-
--- insert the index entry to the categories subtable
-function categorize(codepoints, entry, categories)
- local subcategories = categories.categories
- -- return category name from the Unicode block of the first character
- local category = getCategory(codepoints)
- -- if the categories doesn't use this code block, categorize it as other
- local used = subcategories[category] and category or "other"
- table.insert(subcategories[used], entry)
-end
-
--- convert categories back to index list
-function uncategorize(ordering_categories)
- local newlist = {}
- -- make new index order based on defined categories
- for _, category in ipairs(ordering_categories.order) do
- for _,entry in ipairs(ordering_categories.categories[category]) do
- newlist[#newlist+1] = entry
- end
- end
- return newlist
-end
-
-
-function UTFCompare(a,b)
- local A = a["SortKey"]
- local B = b["SortKey"]
- return collator_obj:compare_strings(A,B)
-end
-
-function getSortChar(codepoints)
- if #codepoints > 0 then
- local codes, pos = collator_obj:get_lowest_char(codepoints, 1)
- if not codes then
- -- if the first character in the sort key doesn't return letter
- -- continue until we find some
- table.remove(codepoints, 1)
- return getSortChar(codepoints)
- end
- local sort_char = utf8.char(table.unpack(codes))
- -- print unicode category of the first char
- return upper(sort_char) -- use unicode.utf8.upper to make the char uppercase
- end
-end
-
-function SORTendhook(list)
- -- get the headers for letter groups
- for i=1, #list do
- v = list[i]
- -- the collator:get_lowest_char will return character on the given
- -- position. It will be lowercase and without accents.
- local codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.SortKey))
- v.sortChar = getSortChar(codepoints) --or getSortChar(collator_obj:string_to_codepoints(NormalizedUpper(v.Entry)))
- if not v.sortChar then
- -- alternativelly use v.Entry if SortKey doesn't contain usable string
- codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.Entry))
- v.sortChar = getSortChar(codepoints)
- end
- end
- return list
-end
-
--- We use Lua-UCA methods for sorting and determining first characters, so
--- alphabet list is obsolete
-
-alphabet_lower = { }
-alphabet_upper = { }
diff --git a/indexing/xindex/lualatex/xindex-pretty.lua b/indexing/xindex/lualatex/xindex-pretty.lua
index 3e4f12a016..b671ba004e 100644
--- a/indexing/xindex/lualatex/xindex-pretty.lua
+++ b/indexing/xindex/lualatex/xindex-pretty.lua
@@ -5,7 +5,7 @@
--
if not modules then modules = { } end modules ['xindex-pretty'] = {
- version = 0.22,
+ version = 0.23,
comment = "dump a Lua table for debugging",
author = "Steve Donovan",
copyright = "Steve Donovan",
diff --git a/indexing/xindex/lualatex/xindex-yannis.lua b/indexing/xindex/lualatex/xindex-yannis.lua
new file mode 100644
index 0000000000..85bef308b9
--- /dev/null
+++ b/indexing/xindex/lualatex/xindex-yannis.lua
@@ -0,0 +1,260 @@
+-----------------------------------------------------------------------
+-- FILE: xindex-yannis.lua
+-- DESCRIPTION: configuration file for xindex.lua
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+-----------------------------------------------------------------------
+
+if not modules then modules = { } end modules ['xindex-yannis'] = {
+ version = 0.23,
+ comment = "main configuration to xindex.lua",
+ author = "Herbert Voss",
+ copyright = "Herbert Voss",
+ license = "LPPL 1.3"
+}
+
+itemPageDelimiter = "," -- Hello, 14
+compressPages = true -- something like 12--15, instaead of 12,13,14,15. the |( ... |) syntax is still valid
+fCompress = false -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5
+minCompress = 2 -- 14--17 or
+rangeSymbol = "-" -- 14-17 instead of --
+numericPage = true -- for non numerical pagenumbers, like "VI-17"
+sublabels = {"", "-\\,", "--\\,", "---\\,"} -- for the (sub(sub(sub-items first one is for item
+pageNoPrefixDel = "" -- a delimiter for page numbers like "VI-17" -- not used !!!
+indexOpening = "" -- commands after \begin{theindex}
+idxnewletter = "\\textbf" -- Only valid if -n is not set
+
+
+--[[
+ Each character's position in this array-like table determines its 'priority'.
+ Several characters in the same slot have the same 'priority'.
+]]
+alphabet_lower = { -- for sorting
+ { 'α', 'ά', 'ὰ', 'ᾶ', 'ἀ', 'ἄ', 'ἂ', 'ἆ', 'ἁ', 'ἅ', 'ἃ', 'ἇ', 'ᾳ', 'ᾴ', 'ᾲ', 'ᾷ', 'ᾀ', 'ᾄ', 'ᾂ', 'ᾆ', 'ᾁ', 'ᾅ', 'ᾃ', 'ᾇ' },
+ { 'β', 'ϐ' },
+ { 'γ' },
+ { 'δ' },
+ { 'ε', 'έ', 'ὲ', 'ἐ', 'ἔ', 'ἒ', 'ἑ', 'ἕ', 'ἓ' },
+ { 'ζ' },
+ { 'η', 'ή', 'ὴ', 'ῆ', 'ἠ', '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}
+
+
+function SORTendhook(list)
+ print ("We have "..#list.." total list entries")
+ local greek = {}
+ local latin = {}
+ local cyrillic = {}
+ local symbols = {}
+ local numbers = {}
+ local others = {}
+ local firstChar, charType
+ local firstCharNumber
+ local v
+ for i=1,#list do
+ v = list[i]
+ firstChar = NormalizedUppercase(utf.sub(v["sortChar"],1,1))
+ v["sortChar"] = firstChar -- to be sure it is an uppercase unicode char
+ firstCharNumber = string.utfvalue(firstChar)
+ charType = getCharType(firstChar)
+-- print (utf.sub(v["sortChar"],1,1).."->"..firstChar.." ("..firstCharNumber..") ".." ("..charType..")")
+ if charType == 0 then
+ symbols[#symbols+1] = v
+ elseif charType == 1 then
+ numbers[#numbers+1] = v
+ elseif firstCharNumber > 0x052F then -- 0x052F is last cyrillic character
+ others[#others+1] = v
+ elseif firstCharNumber >= 0x0400 then -- 0x0400-0x052F cyrillic characters
+ cyrillic[#cyrillic+1] = v
+ elseif firstCharNumber <= 0x03FF then -- 0x03FF is last greek character
+ if firstCharNumber >= 0x0370 then
+ greek[#greek+1] = v -- 0x0370-0x03FF greek characters
+ elseif firstCharNumber <= 0x024F then
+ if firstCharNumber >= 0x041 then -- 0x041-0x024F latin character
+ latin[#latin+1] = v
+ else
+ others[#others+1] = v -- everything else
+ end
+ end
+ end
+ end
+ print ("We have "..#greek.." Greek entries")
+ print ("We have "..#latin.." Latin entries")
+ print ("We have "..#cyrillic.." Cyrillic entries")
+ print ("We have "..#symbols.." Symbol entries")
+ print ("We have "..#numbers.." Number entries")
+ print ("We have "..#others.." other entries")
+ list = {}
+ for i = 1,#greek do list[#list+1] = greek[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#latin do list[#list+1] = latin[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#cyrillic do list[#list+1] = cyrillic[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#symbols do list[#list+1] = symbols[i] end
+ for i = 1,#numbers do list[#list+1] = numbers[i] end
+ for i = 1,#others do list[#list+1] = others[i] end
+ print ("Sorted "..#list.." entries")
+ return list
+end
+
diff --git a/indexing/xindex/scripts/xindex.lua b/indexing/xindex/scripts/xindex.lua
index d4316b2949..2f4654ec13 100755
--- a/indexing/xindex/scripts/xindex.lua
+++ b/indexing/xindex/scripts/xindex.lua
@@ -8,7 +8,7 @@
-----------------------------------------------------------------------
xindex = xindex or { }
- local version = 0.22
+ local version = 0.23
xindex.version = version
--xindex.self = "xindex"
@@ -49,6 +49,7 @@ local args = require ('xindex-lapp') [[
-o,--output (default "")
-l,--language (default en)
-p,--prefix (default L)
+ -u,--use_UCA
<input> (string)
]]
@@ -174,6 +175,8 @@ escape_chars = { -- by default " is the escape char
{esc_char..')', '//escapedparenright//',')' }
}
+local language = "en" -- default language
+
language = string.lower(args["language"]):sub(1, 2)
writeLog(2,"Language = "..language.."\n",1)
if (indexheader[language] == nil) then
@@ -189,6 +192,39 @@ else
page_folium = folium[language]
end
+use_UCA = args["use_UCA"]
+if use_UCA then
+ writeLog(1,"Will use LUA-UCA\n",1)
+ ducet = require "lua-uca.lua-uca-ducet"
+ collator = require "lua-uca.lua-uca-collator"
+ languages = require "lua-uca.lua-uca-languages"
+ collator_obj = collator.new(ducet)
+
+ local uca_config_file = "xindex-cfg-uca.lua"
+ writeLog(2,"Loading local UCA config file "..uca_config_file,0)
+ UCA_Config_File = kpse.find_file(uca_config_file)
+ uca_cfg = require(UCA_Config_File)
+ writeLog(2," ... done\n",0)
+
+-- language name specified on the command line doesn't seem to be available
+-- in the config file, so we just try to find it ourselves
+ for i, a in ipairs(arg) do
+ if a == "-l" or a=="--language" then
+ language = arg[i+1]
+ break
+ end
+ end
+
+ if languages[language] then
+ print("[Lua-UCA] Loading language: " .. language)
+ collator_obj = languages[language](collator_obj)
+ end
+else
+ writeLog(1,"Will _not_ use LUA-UCA\n",1)
+end
+
+upper = unicode.utf8.upper
+
no_caseSensitive = args["no_casesensitive"]
if no_caseSensitive then
writeLog(1,"Sorting will be no case sensitive\n",1)