texlive[60242] trunk: xindex (14aug21)
commits+karl at tug.org
commits+karl at tug.org
Sat Aug 14 22:49:46 CEST 2021
Revision: 60242
http://tug.org/svn/texlive?view=revision&revision=60242
Author: karl
Date: 2021-08-14 22:49:46 +0200 (Sat, 14 Aug 2021)
Log Message:
-----------
xindex (14aug21)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
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/README.md
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh
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-DIN2.lua
trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua
trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.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-dtk.lua
trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.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
Added Paths:
-----------
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf
trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex
trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/lualatex/xindex/scripts/
Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl 2021-08-14 20:49:46 UTC (rev 60242)
@@ -1,12 +1,12 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 59637 2021-06-19 15:17:38Z karl $
+# $Id: tlmgr.pl 60157 2021-08-04 01:42:52Z preining $
#
# Copyright 2008-2021 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
-my $svnrev = '$Revision: 59637 $';
-my $datrev = '$Date: 2021-06-19 17:17:38 +0200 (Sat, 19 Jun 2021) $';
+my $svnrev = '$Revision: 60157 $';
+my $datrev = '$Date: 2021-08-04 03:42:52 +0200 (Wed, 04 Aug 2021) $';
my $tlmgrrevision;
my $tlmgrversion;
my $prg;
@@ -6465,7 +6465,7 @@
}
info("=========================== active config files ==========================\n");
for my $m (sort(qw/fmtutil.cnf config.ps mktex.cnf pdftexconfig.tex/)) {
- info(sprintf("%-17s %s", "$m:", `kpsewhich $m`));
+ info(sprintf("%-17s %s", "$m:", `kpsewhich $m` || "(not found!)\n"));
}
for my $m (qw/texmf.cnf updmap.cfg/) {
for my $f (`kpsewhich -all $m`) {
@@ -10231,7 +10231,7 @@
distribution (L<https://tug.org/texlive>) and both are licensed under the
GNU General Public License Version 2 or later.
-$Id: tlmgr.pl 59637 2021-06-19 15:17:38Z karl $
+$Id: tlmgr.pl 60157 2021-08-04 01:42:52Z preining $
=cut
# test HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html
Modified: trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Build/source/texk/texlive/linked_scripts/xindex/xindex.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -6,11 +6,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL 1.3
--
--- $Id: xindex.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex.lua 10 2021-08-14 07:50:17Z hvoss $
-----------------------------------------------------------------------
xindex = xindex or { }
- local version = 0.30
+ local version = 0.31
xindex.version = version
--xindex.self = "xindex"
@@ -32,13 +32,13 @@
kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
-print ("filename "..f)
+--print ("filename "..f)
+
require("lualibs") -- all part of LuaTeX
require('unicode')
require('string')
require("lpeg")
-
local args = require ('xindex-lapp') [[
parameter handling
-q,--quiet
@@ -53,10 +53,10 @@
-l,--language (default en)
-p,--prefix (default L)
-u,--use_UCA
- <input> (string)
+ -s,--use_stdin
+ <files...> (default stdin) .idx file(s)
]]
-
--[[
No -v flag, v is just { false }. not args.v[1] is true, so vlevel becomes 0.
One -v flags, v is { true }
@@ -76,6 +76,8 @@
os.exit()
end
+useStdInput = args["use_stdin"]
+
--local inspect = require 'inspect'
--print(inspect(args))
@@ -91,46 +93,70 @@
end
]]
+require('xindex-baselib')
---[[
-if not args["input"] then
- io.write ("Filename: ")
- inFile = io.read()
-else
- inFile = args["input"]
+local nInFiles = #args.files
+if not useStdInput then
+ --print(tostring(nInFiles).." input files are given!")
+ inFiles = {} --args.files as strings
+ for i = 1,nInFiles do
+ local file = args.files_name[i]
+-- test for extension is in xindex-lapp
+-- if not file_exists(file) then
+-- if file_exists(file..".idx") then
+-- inFiles[#inFiles+1] = file..".idx"
+-- else
+-- print("Inputfile "..file.." or "..file..".idx not found!\n")
+-- end
+-- else
+ inFiles[#inFiles+1] = file
+-- end
+ end
end
-]]
-require('xindex-lib')
+-- print ("Check Logfile:")
-inFile = args["input"]
-if not file_exists(inFile) then
- if file_exists(inFile..".idx") then
- inFile = inFile..".idx"
- else
- writeLog(2,"Inputfile "..inFile.." or "..inFile..".idx not found!\n",0)
- os.exit()
- end
-end
+local filename
+logfilename = ""
-local filename
-local logfilename
if args["output"] == '""' then
- if inFile:sub(inFile:len()-3,inFile:len()) == ".idx" then
- filename = inFile:sub(1,inFile:len()-3).."ind"
- logfilename = inFile:sub(1,inFile:len()-3).."ilg"
+ if not useStdInput then
+ if inFiles[1]:sub(inFiles[1]:len()-3,inFiles[1]:len()) == ".idx" then
+ filename = inFiles[1]:sub(1,inFiles[1]:len()-3).."ind"
+ if nInFiles > 1 then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = inFiles[1]:sub(1,inFiles[1]:len()-3).."ilg"
+ end
+ else
+ filename = inFiles[1]..".ind"
+ if nInFiles > 1 then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = inFiles[1]..".ilg"
+ end
+ end
else
- filename = inFile..".ind"
- logfilename = inFile..".ilg"
+ filename = "xindex.ind"
+ logfilename = "xindex.ilg"
end
else
filename = args.output
- logfilename = filename:gsub('%p...','')..".ilg"
+ if nInFiles > 1 or useStdInput then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = filename:gsub('%p...','')..".ilg"
+ end
end
+
+
logFile = io.open(logfilename,"w+")
+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,"Open outputfile "..filename,0)
outFile = io.open(filename,"w+")
@@ -147,7 +173,7 @@
writeLog(1,"---------- parameter ----------\n",1)
end
-writeLog(2,"Using input file: "..inFile.."\n",0)
+-- writeLog(2,"Using input file: "..inFile.."\n",0)
labelPrefix = args.prefix
writeLog(2,"Label prefix: "..labelPrefix.."\n",-1)
@@ -254,6 +280,7 @@
writeLog(2,"... done\n",0)
writeLog(1,"Starting base file ... \n",2)
+
BaseRunFile = kpse.find_file("xindex-base.lua")
dofile(BaseRunFile)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG 2021-08-14 20:49:46 UTC (rev 60242)
@@ -1,3 +1,7 @@
+0.31 2021-08-13 - fix introduced bug for roman page numbers
+ - add optional argument -s for standard input
+ - allow piping with standard input
+ - allow more than one input file
0.30 2021-07-07 - added otional argument -b for no label setting in the <index>.ind
0.29 2021-07-05 - don't use language specific names for the labels
- use math.max()
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/README.md 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/README.md 2021-08-14 20:49:46 UTC (rev 60242)
@@ -9,6 +9,7 @@
* xindex-cfg-common.lua -- main config module
* xindex-cfg-uca.lua -- config module for uca
* xindex-base.lua -- base file
+* xindex-baselib.lua -- base file
* xindex-lib.lua -- functions module
* xindex-lapp.lua -- read parameter
* xindex-unicode.lua -- list of Unicode categories
@@ -15,8 +16,12 @@
The syntax of `xindex`
- xindex [options] <inputfile>[.idx]
+ xindex [options] <inputfile>[.idx] <inputfile>[.idx] ...
+ <prog> | xindex -s ...
+ cat <input file> | xindex -s ...
+ xindex -s ... < input file
+
possible options are (short,long):
-q,--quiet
-h,--help
@@ -25,12 +30,13 @@
-e,--escapechar (default ")
-n,--noheadings
-a,--no_casesensitive
- -b,--no_label
+ -b,--no_labels
-o,--output (default "")
-l,--language (default en)
-p,--prefix (default L)
-u,--use_UCA
- <input> (string)
+ -s,--use_stdin
+ <files...> (default stdin) .idx file(s)
Testfiles:
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex 2021-08-14 20:49:46 UTC (rev 60242)
@@ -4,7 +4,7 @@
\usepackage{libertinus-otf}
\usepackage{babel}
\usepackage{makeidx}
-\usepackage{dtk-logos}
+\usepackage{hvlogos}
\usepackage[table]{xcolor}
\makeatletter
\def\theindex{% only for demonstration
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind 2021-08-14 20:49:46 UTC (rev 60242)
@@ -1,15 +1,15 @@
\begin{theindex}
-\par\textbf{Symbols}\label{L-xindex-Symbols}
+\par\textbf{Symbols}\label{L-xindex-symbols}
\nopagebreak[4]
- \item \texttt{\"{}\"{}}, {79}
- \item \texttt{\"{}=}, {79}
- \item \texttt{\"{}\textasciitilde}, {79}
+ \item \texttt{""}, {79}
+ \item \texttt{"=}, {79}
+ \item \texttt{"\textasciitilde}, {79}
\item \euro {}, {67}
\item \textacutedbl , {78}
\indexspace
-\textbf{Numbers}\label{L-xindex-Numbers}
+\textbf{Numbers}\label{L-xindex-numbers}
\nopagebreak[4]
\item 3D, {752}
\item 4:3, {621}
@@ -473,11 +473,10 @@
\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}
@@ -548,6 +547,7 @@
\item Tabellenüberschrift
\subitem -\,\nxLPack {longtable}, {259}
\item Tabellenunterschrift
+ \subitem -\,\nxLPack {longtable}, {259}
\item Tabellenverzeichnis, {310}, {475}
\item {\ttfamily tabular} Env., \idxbf{0--218}
\end{theindex}
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex 2021-08-14 20:49:46 UTC (rev 60242)
@@ -4,7 +4,7 @@
\usepackage{libertinus-otf}
\usepackage{babel}
\usepackage{makeidx}
-\usepackage{dtk-logos}
+\usepackage{hvlogos}
%\newcommand\doublequote{"{}}
\let\nxLnotation\texttt
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind 2021-08-14 20:49:46 UTC (rev 60242)
@@ -36,7 +36,7 @@
\item demnach, \hyperpage{35}, \hyperpage{38}
\item Demonstration, \hyperpage{29}, \hyperpage{35}
\item den, \hyperpage{46}
- \item der, \hyperpage{9--31}, \hyperpage{34}, \hyperpage{37}, \hyperpage{41}
+ \item der, \hyperpage{34}, \hyperpage{37}, \hyperpage{41}
\item Deshalb, \hyperpage{14}
\item Deutschland, \hyperpage{8}, \hyperpage{27}
\item die, \hyperpage{21}, \hyperpage{39}, \hyperpage{41}
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind 2021-08-14 20:49:46 UTC (rev 60242)
@@ -1,11 +1,11 @@
\begin{theindex}
-\par\textbf{Symbole}\label{L-xindex-Symbole}
+\par\textbf{Symbols}\label{L-xindex-symbols}
\nopagebreak[4]
\item \textbackslash , {1}
\indexspace
-\textbf{Zahlen}\label{L-xindex-Zahlen}
+\textbf{Numbers}\label{L-xindex-numbers}
\nopagebreak[4]
\item 4711, {1}
@@ -48,7 +48,7 @@
\item demnach, {35}, {38}
\item Demonstration, {29}, {35}
\item den, {46}
- \item der, {9--31}, {34}, {37}, {41}
+ \item der, {34}, {37}, {41}
\item Deshalb, {14}
\item Deutschland, {8}, {27}
\item die, {21}, {39}, {41}
@@ -85,6 +85,7 @@
\item Festakt, {19}
\item Flaggen, {36}
\item Flüchtlinge, {11}
+ \item foo, {1}, \textit{1f}, \see{bar}{2}, {2}, \textbf{3}, {3f}
\item Frust, {17}
\item für, {10}, {26}
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx 2021-08-14 20:49:46 UTC (rev 60242)
@@ -0,0 +1,14 @@
+\indexentry {Lamport@{Lamport}, Leslie}{xxxvi}
+\indexentry {Downes@{Downes}, Michael}{xxxvi}
+\indexentry {Gordon@{Gordon}, Peter}{xxxvi}
+\indexentry {Ryan@{Ryan}, Elizabeth}{xxxvi}
+\indexentry {Beeton@{Beeton}, Barbara}{xxxvi}
+\indexentry {Rhead@{Rhead}, David}{xxxvi}
+\indexentry {Vulis@{Vulis}, Michael}{xxxvii}
+\indexentry {Rowley@{Rowley}, Chris}{xxxvii}
+\indexentry {Wong@{Wong}, Wai}{xxxvii}
+\indexentry {Downes@{Downes}, Michael}{xxxvii}
+\indexentry {Wetmore@{Wetmore}, Alan}{xxxvii}
+\indexentry {Knuth@{Knuth}, Donald}{1}
+\indexentry {Knuth@{Knuth}, Donald}{2}
+\indexentry {Lamport@{Lamport}, Leslie}{2}
Property changes on: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind 2021-08-14 20:49:46 UTC (rev 60242)
@@ -0,0 +1,46 @@
+
+\begin{theindex}
+
+\indexspace
+\textbf{B}\label{L-xindex-B}
+\nopagebreak[4]
+ \item {Beeton}, Barbara, {xxxvi}
+
+\indexspace
+\textbf{D}\label{L-xindex-D}
+\nopagebreak[4]
+ \item {Downes}, Michael, {xxxvi}, {xxxvii}
+
+\indexspace
+\textbf{G}\label{L-xindex-G}
+\nopagebreak[4]
+ \item {Gordon}, Peter, {xxxvi}
+
+\indexspace
+\textbf{K}\label{L-xindex-K}
+\nopagebreak[4]
+ \item {Knuth}, Donald, {1f}
+
+\indexspace
+\textbf{L}\label{L-xindex-L}
+\nopagebreak[4]
+ \item {Lamport}, Leslie, {xxxvi}, {2}
+
+\indexspace
+\textbf{R}\label{L-xindex-R}
+\nopagebreak[4]
+ \item {Rhead}, David, {xxxvi}
+ \item {Rowley}, Chris, {xxxvii}
+ \item {Ryan}, Elizabeth, {xxxvi}
+
+\indexspace
+\textbf{V}\label{L-xindex-V}
+\nopagebreak[4]
+ \item {Vulis}, Michael, {xxxvii}
+
+\indexspace
+\textbf{W}\label{L-xindex-W}
+\nopagebreak[4]
+ \item {Wetmore}, Alan, {xxxvii}
+ \item {Wong}, Wai, {xxxvii}
+\end{theindex}
Property changes on: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf 2021-08-14 20:49:46 UTC (rev 60242)
Property changes on: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex 2021-08-14 20:49:46 UTC (rev 60242)
@@ -0,0 +1,12 @@
+\documentclass[paper=a4,parskip=half-,ngerman]{scrartcl}
+\usepackage{fontspec}
+\usepackage{libertinus-otf}
+\usepackage{babel}
+
+\usepackage{makeidx}
+\begin{document}
+
+\printindex
+
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh 2021-08-14 20:49:46 UTC (rev 60242)
@@ -16,6 +16,10 @@
xindex -l de demo3 > /dev/null
lualatex demo3 > /dev/null
+echo "demo4"
+xindex demo4 > /dev/null
+lualatex demo4 > /dev/null
+
echo "demo-hyperref"
xindex demo-hyperref > /dev/null
lualatex demo-hyperref > /dev/null
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex 2021-08-14 20:49:46 UTC (rev 60242)
@@ -36,10 +36,9 @@
\gdef\DoubleperCent{%%}
}
-
\usepackage{xcolor,fancyvrb,varioref}
\usepackage{xltabular}
-\usepackage{dtk-logos} % for Wikipedia W
+\usepackage{hvlogos} % for Wikipedia W
\usepackage{listings}
\usepackage{dtk-extern} % for Wikipedia W
\lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX}
@@ -81,7 +80,7 @@
\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\xIndexVersion{#2}}
-\setVersion{version = 0.30}% can be automatically changed by perl
+\setVersion{version = 0.31}% can be automatically changed by perl
\setkeys{dtk}{cleanup=true,force}
@@ -101,8 +100,9 @@
Denis Bitouzé;
Brian Dunn;
Michal Hoftich;
+Frank Mittelbach;
Heiko Oberdiek;
-Matteo Paolini;\\
+Matteo Paolini;
Florent Rougon;
Martin Sievers;
Simon Spiegel
@@ -157,7 +157,7 @@
\subsection{Syntax}
-The \Index{syntax} is \verb|xindex [...] <file>| where \verb|[...]| are optional \Index{argument}s, either in short or
+The \Index{syntax} is \verb|xindex [...] <file(s)>| where \verb|[...]| are optional \Index{argument}s, either in short or
long form which, of course, can be mixed:
\begin{verbatim}
@@ -174,7 +174,8 @@
[-l,--language ] default is en
[-p,--prefix] default L
[-u,--use_UCA ] default is false
- <input file>
+ [-s,--use_stdin ] default is false
+ <files...> (default stdin) file(s)[.idx] one or more files
\end{verbatim}
For example:
@@ -181,8 +182,30 @@
\begin{verbatim}
xindex -q -l fr -b myDoc
+xindex -l de -c DIN2 demo1 demo2 demo3
+xindex -c norsk -o index.ind demo1 demo2.bdx demo3.adx
\end{verbatim}
+\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
+ output data will be \texttt{myDoc.ind} and logfile \texttt{myDoc.ilg}
+\item \texttt{-l de}: german language setting; \texttt{-c DIN2}: config file \texttt{xindex-DIN2.lua}; \texttt{demo1 demo2 demo3}: input data files with or without
+ extension \texttt{.idx} \newline
+ output data will be \texttt{demo1.ind} and logfile \texttt{xindex.ilg}}
+\item \texttt{-c norsk}: config file \texttt{xindex-norsk.lua}; \texttt{-o index.ind}: output file; \texttt{demo1 demo2.bdx demo3.adx}: input data files with or without
+ extension \texttt{.idx} \newline
+ output data will be \texttt{xindex.ind} and logfile \texttt{xindex.ilg}
+\end{enumerate}
+
+It is also possible to use standard input for the index data, which needs the \verb|-s| parameter:
+
+\begin{verbatim}
+cat myDoc.idx | xindex -q -l fr -b -s
+xindex -l de -c DIN2 < myDoc.idx
+\end{verbatim}
+
+
+
\iffalse
local args = require ('xindex-lapp') [[
parameter handling
@@ -198,7 +221,8 @@
-l,--language (default en)
-p,--prefix (default L)
-u,--use_UCA
- <input> (string)
+ -s,--use_stdin
+ <files...> (default stdin) [.idx] file(s)
]]
\fi
Modified: trunk/Master/texmf-dist/scripts/xindex/xindex.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/xindex/xindex.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/scripts/xindex/xindex.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -6,11 +6,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL 1.3
--
--- $Id: xindex.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex.lua 10 2021-08-14 07:50:17Z hvoss $
-----------------------------------------------------------------------
xindex = xindex or { }
- local version = 0.30
+ local version = 0.31
xindex.version = version
--xindex.self = "xindex"
@@ -32,13 +32,13 @@
kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
-print ("filename "..f)
+--print ("filename "..f)
+
require("lualibs") -- all part of LuaTeX
require('unicode')
require('string')
require("lpeg")
-
local args = require ('xindex-lapp') [[
parameter handling
-q,--quiet
@@ -53,10 +53,10 @@
-l,--language (default en)
-p,--prefix (default L)
-u,--use_UCA
- <input> (string)
+ -s,--use_stdin
+ <files...> (default stdin) .idx file(s)
]]
-
--[[
No -v flag, v is just { false }. not args.v[1] is true, so vlevel becomes 0.
One -v flags, v is { true }
@@ -76,6 +76,8 @@
os.exit()
end
+useStdInput = args["use_stdin"]
+
--local inspect = require 'inspect'
--print(inspect(args))
@@ -91,46 +93,70 @@
end
]]
+require('xindex-baselib')
---[[
-if not args["input"] then
- io.write ("Filename: ")
- inFile = io.read()
-else
- inFile = args["input"]
+local nInFiles = #args.files
+if not useStdInput then
+ --print(tostring(nInFiles).." input files are given!")
+ inFiles = {} --args.files as strings
+ for i = 1,nInFiles do
+ local file = args.files_name[i]
+-- test for extension is in xindex-lapp
+-- if not file_exists(file) then
+-- if file_exists(file..".idx") then
+-- inFiles[#inFiles+1] = file..".idx"
+-- else
+-- print("Inputfile "..file.." or "..file..".idx not found!\n")
+-- end
+-- else
+ inFiles[#inFiles+1] = file
+-- end
+ end
end
-]]
-require('xindex-lib')
+-- print ("Check Logfile:")
-inFile = args["input"]
-if not file_exists(inFile) then
- if file_exists(inFile..".idx") then
- inFile = inFile..".idx"
- else
- writeLog(2,"Inputfile "..inFile.." or "..inFile..".idx not found!\n",0)
- os.exit()
- end
-end
+local filename
+logfilename = ""
-local filename
-local logfilename
if args["output"] == '""' then
- if inFile:sub(inFile:len()-3,inFile:len()) == ".idx" then
- filename = inFile:sub(1,inFile:len()-3).."ind"
- logfilename = inFile:sub(1,inFile:len()-3).."ilg"
+ if not useStdInput then
+ if inFiles[1]:sub(inFiles[1]:len()-3,inFiles[1]:len()) == ".idx" then
+ filename = inFiles[1]:sub(1,inFiles[1]:len()-3).."ind"
+ if nInFiles > 1 then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = inFiles[1]:sub(1,inFiles[1]:len()-3).."ilg"
+ end
+ else
+ filename = inFiles[1]..".ind"
+ if nInFiles > 1 then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = inFiles[1]..".ilg"
+ end
+ end
else
- filename = inFile..".ind"
- logfilename = inFile..".ilg"
+ filename = "xindex.ind"
+ logfilename = "xindex.ilg"
end
else
filename = args.output
- logfilename = filename:gsub('%p...','')..".ilg"
+ if nInFiles > 1 or useStdInput then
+ logfilename = "xindex.ilg"
+ else
+ logfilename = filename:gsub('%p...','')..".ilg"
+ end
end
+
+
logFile = io.open(logfilename,"w+")
+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,"Open outputfile "..filename,0)
outFile = io.open(filename,"w+")
@@ -147,7 +173,7 @@
writeLog(1,"---------- parameter ----------\n",1)
end
-writeLog(2,"Using input file: "..inFile.."\n",0)
+-- writeLog(2,"Using input file: "..inFile.."\n",0)
labelPrefix = args.prefix
writeLog(2,"Label prefix: "..labelPrefix.."\n",-1)
@@ -254,6 +280,7 @@
writeLog(2,"... done\n",0)
writeLog(1,"Starting base file ... \n",2)
+
BaseRunFile = kpse.find_file("xindex-base.lua")
dofile(BaseRunFile)
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-DIN2.lua 3 2021-07-07 07:21:56Z hvoss $
+-- $Id: xindex-DIN2.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.30,
+ version = 0.31,
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,13 +5,13 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-HAdW-eKO.lua 3 2021-07-07 07:21:56Z hvoss $
+-- $Id: xindex-HAdW-eKO.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
--
-- configuration for index files of the Heidelberger Akademie der Wissenschaften
if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = {
- version = 0.30,
+ version = 0.31,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,10 +5,10 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-base.lua 3 2021-07-07 07:21:56Z hvoss $
+-- $Id: xindex-base.lua 9 2021-08-13 19:42:48Z hvoss $
-----------------------------------------------------------------------
-local info = { version = 0.30 }
+local info = { version = 0.31 }
-- check config
if pageNoPrefixDel ~= "" then
@@ -16,10 +16,22 @@
pageNoPrefixPattern = "^.*"..pageNoPrefixDel
end
-writeLog(2,"Read Data from file "..inFile.." ... \n",0)
-local lines = read_lines_from(inFile)
-writeLog(2,#lines.." lines of data read\n",0)
+local lines = {}
+if useStdInput then
+ writeLog(2,"Read Data from stdin ... \n",0)
+ for line in io.lines() do
+ lines[#lines+1] = line
+ end
+ writeLog(2,#lines.." lines of data read\n",0)
+else
+ for i=1,#inFiles do
+ writeLog(2,"Read Data from file "..inFiles[i].." ... \n",0)
+ lines = array_concat(lines, read_lines_from(inFiles[i]))
+ writeLog(2,#lines.." lines of data read\n",0)
+ end
+end
+
if vlevel > 1 then
writeLog(1,"--------------- Input data -----------------\n",2)
for _,l in pairs(lines) do writeLog(1,l.."\n",2) end
Added: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -0,0 +1,159 @@
+-----------------------------------------------------------------------
+-- FILE: xindex-baselib.lua
+-- DESCRIPTION: baselibrary for xindex.lua
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+--
+-- $Id: xindex-baselib.lua 11 2021-08-14 09:46:46Z hvoss $
+-----------------------------------------------------------------------
+
+if not modules then modules = { } end modules ['xindex-baselib'] = {
+ version = 0.31,
+ comment = "base library to xindex.lua",
+ author = "Herbert Voss",
+ copyright = "Herbert Voss",
+ license = "LPPL 1.3"
+}
+
+function dofile(filename)
+ local file = kpse.find_file(filename)
+ local f = assert(loadfile(file))
+ return f()
+end
+
+-- see if the file exists
+function file_exists(file)
+local f = io.open(file, "rb")
+if f then f:close() end
+return f ~= nil
+end
+
+function array_concat(...)
+ local t = {}
+ for n = 1,select("#",...) do
+ local arg = select(n,...)
+ if type(arg)=="table" then
+ for _,v in ipairs(arg) do
+ t[#t+1] = v
+ end
+ else
+ t[#t+1] = arg
+ end
+ end
+ return t
+end
+
+function IntegerOrString(str)
+ local x = tonumber(str)
+ if x == nil -- true, if str contains _not_ only digits -> integer
+ then return str
+ else return x
+ end
+end
+
+function getPathFileExt(str)
+ local filepath = str:match("(.*[/\\])")
+ local filename = str:match("^.+/(.+)$")
+ local fileext = str:match("^.+(%..+)$")
+ return filepath,filename,fileext
+end
+
+local romanMap = {
+ I = 1,
+ V = 5,
+ X = 10,
+ L = 50,
+ C = 100,
+ D = 500,
+ M = 1000,
+}
+
+local numbers = { 1, 5, 10, 50, 100, 500, 1000 }
+local romanchars = { "I", "V", "X", "L", "C", "D", "M" }
+local RomanNumerals = { }
+
+function numberToRoman(s)
+ --s = tostring(s)
+ s = tonumber(s)
+ if not s or s ~= s then error"Unable to convert to number" end
+ if s == math.huge then error"Unable to convert infinity" end
+ s = math.floor(s)
+ if s <= 0 then return s end
+ local ret = ""
+ for i = #numbers, 1, -1 do
+ local num = numbers[i]
+ while s - num >= 0 and s > 0 do
+ ret = ret .. romanchars[i]
+ s = s - num
+ end
+ for j = 1, i - 1 do
+ local n2 = numbers[j]
+ if s - (num - n2) >= 0 and s < num and s > 0 and num - n2 ~= n2 then
+ ret = ret .. romanchars[j] .. romanchars[i]
+ s = s - (num - n2)
+ break
+ end
+ end
+ end
+ return ret
+end
+
+function romanToNumber(s)
+-- if args_v then print("romanToNumber: "..tostring(s)) end
+-- if not s then return end
+ s = s:upper()
+ local ret = 0
+ local i = 1
+ while i <= s:len() do
+ local c = s:sub(i, i)
+ if c ~= " " then -- allow spaces
+ local m = romanMap[c]
+ if not m then return nil end --error("Unknown Roman Numeral '" .. c .. "'")
+ local next = s:sub(i + 1, i + 1)
+ local nextm = romanMap[next]
+ if next and nextm then
+ if nextm > m then
+ ret = ret + (nextm - m)
+ i = i + 1
+ else
+ ret = ret + m
+ end
+ else
+ ret = ret + m
+ end
+ end
+ i = i + 1
+ end
+ return ret
+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 shellsort(a)
+ local inc = math.ceil( #a / 2 )
+ while inc > 0 do
+ for i = inc, #a do
+ local tmp = a[i]
+ local j = i
+ while j > inc and not UTFCompare(a[j-inc],tmp) do
+ a[j] = a[j-inc]
+ j = j - inc
+ end
+ a[j] = tmp
+ end
+ inc = math.floor( 0.5 + inc / 2.2 )
+ end
+ return a
+end
+
+function stripLeadingSpaces(str)
+ return str:gsub("^%s*(.-)%s*$", "%1")
+end
+
+
Property changes on: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-cfg-common.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-cfg-common.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-common'] = {
- version = 0.30,
+ version = 0.31,
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-cfg-uca.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-cfg-uca.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
- version = 0.30,
+ version = 0.31,
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-cfg.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-cfg.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.30,
+ version = 0.31,
comment = "main configuration to xindex.lua",
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-dtk.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-dtk.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.30,
+ version = 0.31,
comment = "DTK configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -1,7 +1,7 @@
-- lapp.lua
-- Simple command-line parsing using human-readable specification
--
--- $Id: xindex-lapp.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-lapp.lua 9 2021-08-13 19:42:48Z hvoss $
-----------------------------
--~ -- args.lua
--~ local args = require ('lapp') [[
@@ -30,7 +30,7 @@
--~ n 2
--------------------------------
if not modules then modules = { } end modules ['xindex-lapp'] = {
- version = 0.30,
+ version = 0.31,
comment = "read parameter for xindex.lua",
author = "Steve Donovan",
copyright = "Steve Donovan",
@@ -80,7 +80,12 @@
local function open (file,opt)
local val,err = io.open(file,opt)
- if not val then error(err,true) end
+ if not val then
+ val,err = io.open(file..".idx",opt)
+ if not val then
+ error(err,true)
+ end
+ end
append(open_files,val)
return val
end
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-lib.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-lib.lua 9 2021-08-13 19:42:48Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.30,
+ version = 0.31,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -112,6 +112,31 @@
-- return table.concat(str)
--end
+-- get all lines from a file, returns an empty
+-- list/table if the file does not exist
+function read_lines_from(infile)
+ if not file_exists(infile) then return {} end
+ local lines = {}
+ local str
+ local c
+ for line in io.lines(infile) do
+ if line ~= "" then
+ if string.find(line,'\\indexentry',1,true) then
+ str = line:gsub('^\\%a+%s*{','{') -- remove "\\indexentry "
+ writeLog(1,"read_lines: str="..str.." ("..utf.sub(str,2,2)..")\n",2)
+ if getCharType(utf.sub(str,2,2)) == 0 then -- we have a symbol
+ lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
+ else
+ lines[#lines + 1] = str
+ end
+ else
+ lines[#lines + 1] = "\\MACRO<<< "..line -- allow macros between entries
+ end
+ end
+ end
+ return lines
+end
+
function checkVert(str) -- get the | part
local vert = string.find(str,"|",1,true)
if (vert) then
@@ -147,59 +172,6 @@
return str:gsub('[^!|@]+@', '')
end
-function dofile(filename)
- local file = kpse.find_file(filename)
- local f = assert(loadfile(file))
- return f()
-end
-
--- see if the file exists
-function file_exists(file)
-local f = io.open(file, "rb")
-if f then f:close() end
-return f ~= nil
-end
-
--- get all lines from a file, returns an empty
--- list/table if the file does not exist
-function read_lines_from(infile)
- if not file_exists(infile) then return {} end
- local lines = {}
- local str
- local c
- for line in io.lines(infile) do
- if line ~= "" then
- if string.find(line,'\\indexentry',1,true) then
- str = line:gsub('^\\%a+%s*{','{') -- remove "\\indexentry "
- writeLog(1,"read_lines: str="..str.." ("..utf.sub(str,2,2)..")\n",2)
- if getCharType(utf.sub(str,2,2)) == 0 then -- we have a symbol
- lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
- else
- lines[#lines + 1] = str
- end
- else
- lines[#lines + 1] = "\\MACRO<<< "..line -- allow macros between entries
- end
- end
- end
- return lines
-end
-
-function array_concat(...)
- local t = {}
- for n = 1,select("#",...) do
- local arg = select(n,...)
- if type(arg)=="table" then
- for _,v in ipairs(arg) do
- t[#t+1] = v
- end
- else
- t[#t+1] = arg
- end
- end
- return t
-end
-
function findSequences(a) -- look for 1,2,3,4, ...
local b = {}
local firstPage = a[1] -- first page in the sequence
@@ -582,12 +554,13 @@
end
end
+
function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}}
-- a["number"], b["number"] are something like "3" or "VI-17" or "9--31"
writeLog(1,"pageCompare: "..a["number"].." "..b["number"].."\n",2)
if (a["number"] == nil) or (b["number"] == nil) then return true end -- should be no nil here
- local a0 = a["number"] -- can be numeric or alphanumeric
- local b0 = b["number"]
+ local a0 = IntegerOrString(a["number"]) -- can be numeric or alpha or alphanumeric
+ local b0 = IntegerOrString(b["number"])
-- if pageNoPrefixDel ~= "" then ---- not active
-- A = (a0:gsub(pageNoPrefixPattern,''))
-- B = (b0:gsub(pageNoPrefixPattern,''))
@@ -595,10 +568,20 @@
-- b0 = tonumber(B) or romanToNumber(B)
-- else
if numericPage then
+--[[
if (type(a0) == "number") and (type(b0) == "number") then return a0 < b0 end
- if romanToNumber(a0) and (type(b0) == "number") then return true end -- ii < 2
- if (type(a0) == "number") and romanToNumber(b0) then return false end -- ii > 2
+ if romanToNumber(tostring(a0)) and (type(b0) == "number") then return true end -- ii < 2
+ if (type(a0) == "number") and romanToNumber(tostring(b0)) then return false end -- ii > 2
if romanToNumber(a0) and romanToNumber(b0) then return a0 < b0 end -- ii < iii
+]]
+ if (type(a0) == "number") and (type(b0) == "number") then return a0 < b0 end -- 12 < 14 ist true
+ if (type(a0) == "number") then
+ if romanToNumber(b0) then return false else return true end -- 2, ii -> ii, 2; 2, A -> ok
+ end
+ if (type(b0) == "number") then
+ if romanToNumber(a0) then return true else return false end -- ii, 2 -> ok; A, 2 -> 2, A
+ end
+ if romanToNumber(tostring(a0)) and romanToNumber(tostring(b0)) then return a0 < b0 end -- ii < iii or A < B
-- now we have some special page numbers
A = tostring(a0)
B = tostring(b0)
@@ -722,14 +705,6 @@
end
end
-
-function getPathFileExt(str)
- local filepath = str:match("(.*[/\\])")
- local filename = str:match("^.+/(.+)$")
- local fileext = str:match("^.+(%..+)$")
- return filepath,filename,fileext
-end
-
function printList(Index,level)
for k,v in pairs(Index) do
if v["Entry"] then
@@ -754,75 +729,6 @@
end
end
-local romanMap = {
- I = 1,
- V = 5,
- X = 10,
- L = 50,
- C = 100,
- D = 500,
- M = 1000,
-}
-
-local numbers = { 1, 5, 10, 50, 100, 500, 1000 }
-local romanchars = { "I", "V", "X", "L", "C", "D", "M" }
-local RomanNumerals = { }
-
-function numberToRoman(s)
- --s = tostring(s)
- s = tonumber(s)
- if not s or s ~= s then error"Unable to convert to number" end
- if s == math.huge then error"Unable to convert infinity" end
- s = math.floor(s)
- if s <= 0 then return s end
- local ret = ""
- for i = #numbers, 1, -1 do
- local num = numbers[i]
- while s - num >= 0 and s > 0 do
- ret = ret .. romanchars[i]
- s = s - num
- end
- for j = 1, i - 1 do
- local n2 = numbers[j]
- if s - (num - n2) >= 0 and s < num and s > 0 and num - n2 ~= n2 then
- ret = ret .. romanchars[j] .. romanchars[i]
- s = s - (num - n2)
- break
- end
- end
- end
- return ret
-end
-
-function romanToNumber(s)
--- if args_v then print("romanToNumber: "..tostring(s)) end
--- if not s then return end
- s = s:upper()
- local ret = 0
- local i = 1
- while i <= s:len() do
- local c = s:sub(i, i)
- if c ~= " " then -- allow spaces
- local m = romanMap[c]
- if not m then return nil end --error("Unknown Roman Numeral '" .. c .. "'")
- local next = s:sub(i + 1, i + 1)
- local nextm = romanMap[next]
- if next and nextm then
- if nextm > m then
- ret = ret + (nextm - m)
- i = i + 1
- else
- ret = ret + m
- end
- else
- ret = ret + m
- end
- end
- i = i + 1
- end
- return ret
-end
-
function commandEntry(line)
return string.find(line,"\\MACRO<<<",1,true)
end
@@ -939,30 +845,7 @@
return data
end
-function writeLog(i, str, level) -- mode i 0->console; 1->logfile: 2->both
- if not_quiet then
- if level <= vlevel then
- if (i ~= 1) or (i < 0) then io.write(tostring(str)) end
- if i > 0 then logFile:write(tostring(str)) end
- end
- else
- if level < 0 then
- io.write(tostring(str))
- elseif level == 0 then
- logFile:write(tostring(str))
- end
- end
-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
-
-
-
--\indexentry{hello at foo!world at foo!bar|bar}{60}
@@ -973,28 +856,6 @@
]]
-function shellsort(a)
- local inc = math.ceil( #a / 2 )
- while inc > 0 do
- for i = inc, #a do
- local tmp = a[i]
- local j = i
- while j > inc and not UTFCompare(a[j-inc],tmp) do
- a[j] = a[j-inc]
- j = j - inc
- end
- a[j] = tmp
- end
- inc = math.floor( 0.5 + inc / 2.2 )
- end
- return a
-end
-
-function stripLeadingSpaces(str)
- return str:gsub("^%s*(.-)%s*$", "%1")
-end
-
-
-- get Unicode category of the codepoint, if supported
function getCategory(codepoints)
local codepoint = codepoints[1]
@@ -1045,3 +906,18 @@
end
end
+function writeLog(i, str, level) -- mode i 0->console; 1->logfile: 2->both
+ if not_quiet then
+ if level <= vlevel then
+ if (i ~= 1) or (i < 0) then io.write(tostring(str)) end
+ if i > 0 then logFile:write(tostring(str)) end
+ end
+ else
+ if level < 0 then
+ io.write(tostring(str))
+ elseif level == 0 then
+ logFile:write(tostring(str))
+ end
+ end
+end
+
Modified: trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -6,11 +6,11 @@
-- MODIFIED: Sveinung Heggen (2020-01-02)
-- LICENSE: LPPL1.3
--
--- $Id: xindex-norsk.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-norsk.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-no'] = {
- version = 0.30,
+ version = 0.31,
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -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 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-pretty.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-pretty'] = {
- version = 0.30,
+ version = 0.31,
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 2021-08-14 14:37:23 UTC (rev 60241)
+++ trunk/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua 2021-08-14 20:49:46 UTC (rev 60242)
@@ -5,11 +5,11 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL1.3
--
--- $Id: xindex-yannis.lua 4 2021-07-07 07:25:04Z hvoss $
+-- $Id: xindex-yannis.lua 6 2021-08-13 07:08:46Z hvoss $
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-yannis'] = {
- version = 0.30,
+ version = 0.31,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
More information about the tex-live-commits
mailing list.