From d4424601e554a08fb8666350f6aad3cf6486fc92 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 Aug 2021 20:49:46 +0000 Subject: xindex (14aug21) git-svn-id: svn://tug.org/texlive/trunk@60242 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/xindex/CHANGELOG | 4 + Master/texmf-dist/doc/lualatex/xindex/README.md | 12 +- .../doc/lualatex/xindex/scripts/xindex-yannis.lua | 262 --------------------- .../texmf-dist/doc/lualatex/xindex/tests/HADW.pdf | Bin 18924 -> 18345 bytes .../texmf-dist/doc/lualatex/xindex/tests/HADW.tex | 2 +- .../doc/lualatex/xindex/tests/Umlaute.pdf | Bin 15832 -> 15198 bytes .../doc/lualatex/xindex/tests/Umlaute2.pdf | Bin 19533 -> 18887 bytes .../texmf-dist/doc/lualatex/xindex/tests/buch.ind | 14 +- .../texmf-dist/doc/lualatex/xindex/tests/buch.pdf | Bin 40170 -> 39090 bytes .../texmf-dist/doc/lualatex/xindex/tests/buch.tex | 2 +- .../doc/lualatex/xindex/tests/demo-hyperref.ind | 2 +- .../doc/lualatex/xindex/tests/demo-hyperref.pdf | Bin 29389 -> 28627 bytes .../texmf-dist/doc/lualatex/xindex/tests/demo.ind | 7 +- .../texmf-dist/doc/lualatex/xindex/tests/demo.pdf | Bin 35447 -> 34621 bytes .../texmf-dist/doc/lualatex/xindex/tests/demo3.pdf | Bin 9494 -> 9220 bytes .../texmf-dist/doc/lualatex/xindex/tests/demo4.idx | 14 ++ .../texmf-dist/doc/lualatex/xindex/tests/demo4.ind | 46 ++++ .../texmf-dist/doc/lualatex/xindex/tests/demo4.pdf | Bin 0 -> 11887 bytes .../texmf-dist/doc/lualatex/xindex/tests/demo4.tex | 12 + .../doc/lualatex/xindex/tests/runTests.sh | 4 + .../texmf-dist/doc/lualatex/xindex/xindex-doc.pdf | Bin 410832 -> 412315 bytes .../texmf-dist/doc/lualatex/xindex/xindex-doc.tex | 38 ++- Master/texmf-dist/scripts/xindex/xindex.lua | 93 +++++--- .../texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua | 4 +- .../tex/lualatex/xindex/xindex-HAdW-eKO.lua | 4 +- .../texmf-dist/tex/lualatex/xindex/xindex-base.lua | 22 +- .../tex/lualatex/xindex/xindex-baselib.lua | 159 +++++++++++++ .../tex/lualatex/xindex/xindex-cfg-common.lua | 4 +- .../tex/lualatex/xindex/xindex-cfg-uca.lua | 4 +- .../texmf-dist/tex/lualatex/xindex/xindex-cfg.lua | 4 +- .../texmf-dist/tex/lualatex/xindex/xindex-dtk.lua | 4 +- .../texmf-dist/tex/lualatex/xindex/xindex-lapp.lua | 11 +- .../texmf-dist/tex/lualatex/xindex/xindex-lib.lua | 238 +++++-------------- .../tex/lualatex/xindex/xindex-norsk.lua | 4 +- .../tex/lualatex/xindex/xindex-pretty.lua | 4 +- .../tex/lualatex/xindex/xindex-yannis.lua | 4 +- 36 files changed, 453 insertions(+), 525 deletions(-) delete mode 100644 Master/texmf-dist/doc/lualatex/xindex/scripts/xindex-yannis.lua create mode 100644 Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx create mode 100644 Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind create mode 100644 Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf create mode 100644 Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex create mode 100644 Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG b/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG index f3ae68df9a1..a8a1703f225 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG +++ b/Master/texmf-dist/doc/lualatex/xindex/CHANGELOG @@ -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 .ind 0.29 2021-07-05 - don't use language specific names for the labels - use math.max() diff --git a/Master/texmf-dist/doc/lualatex/xindex/README.md b/Master/texmf-dist/doc/lualatex/xindex/README.md index 59a639ac7ab..1a75b7aad77 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/README.md +++ b/Master/texmf-dist/doc/lualatex/xindex/README.md @@ -9,13 +9,18 @@ will be included in at least LuaTeX 1.09 (TeXLive 2019) * 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 The syntax of `xindex` - xindex [options] [.idx] + xindex [options] [.idx] [.idx] ... + | xindex -s ... + cat | xindex -s ... + xindex -s ... < input file + possible options are (short,long): -q,--quiet @@ -25,12 +30,13 @@ possible options are (short,long): -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 - (string) + -s,--use_stdin + (default stdin) .idx file(s) Testfiles: diff --git a/Master/texmf-dist/doc/lualatex/xindex/scripts/xindex-yannis.lua b/Master/texmf-dist/doc/lualatex/xindex/scripts/xindex-yannis.lua deleted file mode 100644 index 2ef45e43606..00000000000 --- a/Master/texmf-dist/doc/lualatex/xindex/scripts/xindex-yannis.lua +++ /dev/null @@ -1,262 +0,0 @@ ------------------------------------------------------------------------ --- FILE: xindex-yannis.lua --- DESCRIPTION: configuration file for xindex.lua --- REQUIREMENTS: --- AUTHOR: Herbert Voß --- LICENSE: LPPL1.3 --- --- $Id: xindex-yannis.lua 4 2021-07-07 07:25:04Z hvoss $ ------------------------------------------------------------------------ - -if not modules then modules = { } end modules ['xindex-yannis'] = { - version = 0.30, - 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 - { 'α', 'ά', 'ὰ', 'ᾶ', 'ἀ', 'ἄ', 'ἂ', 'ἆ', 'ἁ', 'ἅ', 'ἃ', 'ἇ', 'ᾳ', 'ᾴ', 'ᾲ', 'ᾷ', 'ᾀ', 'ᾄ', 'ᾂ', 'ᾆ', 'ᾁ', 'ᾅ', 'ᾃ', 'ᾇ' }, - { 'β', 'ϐ' }, - { 'γ' }, - { 'δ' }, - { 'ε', 'έ', 'ὲ', 'ἐ', 'ἔ', 'ἒ', 'ἑ', 'ἕ', 'ἓ' }, - { 'ζ' }, - { 'η', 'ή', 'ὴ', 'ῆ', 'ἠ', 'ἤ', 'ἢ', 'ἦ', 'ἡ', 'ἥ', 'ἣ', 'ἧ', 'ῃ', 'ῄ', 'ῂ', 'ῇ', 'ᾐ', 'ᾔ', 'ᾒ', 'ᾖ', 'ᾑ', 'ᾕ', 'ᾓ', 'ᾗ' }, - { 'θ' }, - { 'ι', 'ί', 'ὶ', 'ῖ', 'ἰ', 'ἴ', 'ἲ', 'ἶ', 'ἱ', 'ἵ', 'ἳ', 'ἷ', 'ϊ', 'ΐ', 'ῒ', 'ῗ' }, - { 'κ' }, - { 'λ' }, - { 'μ' }, - { 'ν' }, - { 'ξ' }, - { 'ο', 'ό', 'ὸ', 'ὀ', 'ὄ', 'ὂ', 'ὁ', 'ὅ', 'ὃ' }, - { 'π' }, - { 'ρ' }, - { 'σ', 'ς' }, - { 'τ' }, - { 'υ', 'ύ', 'ὺ', 'ῦ', 'ὐ', 'ὔ', 'ὒ', 'ὖ', 'ὑ', 'ὕ', 'ὓ', 'ὗ', 'ϋ', 'ΰ', 'ῢ', 'ῧ' }, - { 'φ' }, - { 'χ' }, - { 'ψ' }, - { 'ω', 'ώ', 'ὼ', 'ῶ', 'ὠ', 'ὤ', 'ὢ', 'ὦ', 'ὡ', 'ὥ', 'ὣ', 'ὧ', 'ῳ', 'ῴ', 'ῲ', 'ῷ', 'ᾠ', 'ᾤ', 'ᾢ', 'ᾦ', 'ᾡ', 'ᾥ', 'ᾣ', 'ᾧ' }, - { 'a', 'á', 'à', 'ä', 'å', 'æ', }, - { 'b' }, - { 'c', 'ç' }, - { 'd' }, - { 'e', 'é', 'è', 'ë' }, - { 'f' }, - { 'g' }, - { 'h' }, - { 'i', 'í', 'ì', 'ï' }, - { 'j' }, - { 'k' }, - { 'l' }, - { 'm' }, - { 'n', 'ñ' }, - { 'o', 'ó', 'ò', 'ö', 'ø', 'œ'}, - { 'p' }, - { 'q' }, - { 'r' }, - { 's', 'š', 'ß' }, - { 't' }, - { 'u', 'ú', 'ù', 'ü' }, - { 'v' }, - { 'w' }, - { 'x' }, - { 'y', 'ý', 'ÿ' }, - { 'z', 'ž' }, - { 'а' }, - { 'б' }, - { 'в' }, - { 'г', 'ѓ' }, - { 'д' }, - { 'е', 'ё' }, - { 'ж' }, - { 'з' }, - { 'и', 'і' }, - { 'й' }, - { 'к' }, - { 'л' }, - { 'м' }, - { 'н' }, - { 'о' }, - { 'п' }, - { 'р' }, - { 'с' }, - { 'т' }, - { 'у' }, - { 'ф' }, - { 'х' }, - { 'ц' }, - { 'ч' }, - { 'ш' }, - { 'щ' }, - { 'ъ' }, - { 'ы' }, - { 'ь' }, - { 'э' }, - { 'ю' }, - { 'я' }, -} -alphabet_upper = { -- for sorting - { 'Α', 'Ά', 'Ἀ', 'Ἄ', 'Ἂ', 'Ἆ', 'Ἁ', 'Ἅ', 'Ἃ', 'Ἇ', 'ᾼ', 'ᾈ', 'ᾌ', 'ᾊ', 'ᾎ', 'ᾉ', 'ᾍ', 'ᾋ', 'ᾏ' }, - { 'Β' }, - { 'Γ' }, - { 'Δ' }, - { 'Ε', 'Έ', 'Ἐ', 'Ἔ', 'Ἒ', 'Ἑ', 'Ἕ', 'Ἓ' }, - { 'Ζ' }, - { 'Η', 'Ή', 'Ἠ', 'Ἤ', 'Ἢ', 'Ἦ', 'Ἡ', 'Ἥ', 'Ἣ', 'Ἧ', 'ῌ', 'ᾘ', 'ᾜ', 'ᾚ', 'ᾞ', 'ᾙ', 'ᾝ', 'ᾟ' }, - { 'Θ' }, - { 'Ι', 'Ί', 'Ἰ', 'Ἴ', 'Ἲ', 'Ἶ', 'Ἱ', 'Ἵ', 'Ἳ', 'Ἷ', 'Ϊ' }, - { 'Κ' }, - { 'Λ' }, - { 'Μ' }, - { 'Ν' }, - { 'Ξ' }, - { 'Ο', 'Ό', 'Ὀ', 'Ὄ', 'Ὂ', 'Ὁ', 'Ὅ', 'Ὃ' }, - { 'Π' }, - { 'Ρ' }, - { 'Σ' }, - { 'Τ' }, - { 'Υ', 'Ύ', 'Ὑ', 'Ὕ', 'Ὓ', 'Ὗ', 'Ϋ' }, - { 'Φ' }, - { 'Χ' }, - { 'Ψ' }, - { 'Ω', 'Ώ', 'Ὠ', 'Ὤ', 'Ὢ', 'Ὦ', 'Ὡ', 'Ὥ', 'Ὣ', 'Ὧ', 'ῼ', 'ᾩ', 'ᾭ', 'ᾫ', 'ᾯ', 'ᾨ', 'ᾬ', 'ᾪ', 'ᾮ' }, - { 'A', 'Á', 'À', 'Ä', 'Å', 'Æ'}, - { 'B' }, - { 'C', 'Ç' }, - { 'D' }, - { 'E', 'È', 'È', 'Ë' }, - { 'F' }, - { 'G' }, - { 'H' }, - { 'I', 'Í', 'Ì', 'Ï' }, - { 'J' }, - { 'K' }, - { 'L' }, - { 'M' }, - { 'N', 'Ñ' }, - { 'O', 'Ó', 'Ò', 'Ö', 'Ø','Œ' }, - { 'P' }, - { 'Q' }, - { 'R' }, - { 'S', 'Š' }, - { 'T' }, - { 'U', 'Ú', 'Ù', 'Ü' }, - { 'V' }, - { 'W' }, - { 'X' }, - { 'Y', 'Ý', 'Ÿ' }, - { 'Z', 'Ž' }, - { 'А' }, - { 'Б' }, - { 'В' }, - { 'Г', 'Ѓ' }, - { 'Д' }, - { 'Е', 'Ё' }, - { 'Ж' }, - { 'З' }, - { 'И', 'І' }, - { 'Й' }, - { 'К' }, - { 'Л' }, - { 'М' }, - { 'Н' }, - { 'О' }, - { 'П' }, - { 'Р' }, - { 'С' }, - { 'Т' }, - { 'У' }, - { 'Ф' }, - { 'Х' }, - { 'Ц' }, - { 'Ч' }, - { 'Ш' }, - { 'Щ' }, - { 'Ъ' }, - { 'Ы' }, - { 'Ь' }, - { 'Э' }, - { 'Ю' }, - { 'Я' }, -} - - -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/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf index 239f431bc92..44577111ea0 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex index 1a837fd93b5..0ce50d0b10d 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/HADW.tex @@ -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 diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf index d91d9f10ec6..2c353bfa291 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf index c2b78f3f185..5803dc5eb78 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/Umlaute2.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind index 57a3d139cff..d03eb1dbc9e 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.ind @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf index 5975dd18f7a..02c8d5b81bf 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex index 8369a1fc634..923618fe9d7 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/buch.tex @@ -4,7 +4,7 @@ \usepackage{libertinus-otf} \usepackage{babel} \usepackage{makeidx} -\usepackage{dtk-logos} +\usepackage{hvlogos} %\newcommand\doublequote{"{}} \let\nxLnotation\texttt diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind index 854bf918702..639cedcaab3 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.ind @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf index dfe9b33aaa9..0317664d465 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/demo-hyperref.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind index 91c44b327dd..ff3bc67f4ea 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.ind @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf index 0df70568641..4aa6b007df2 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/demo.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf index b9718a4e31f..76466c1cfa5 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf and b/Master/texmf-dist/doc/lualatex/xindex/tests/demo3.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx new file mode 100644 index 00000000000..a97595107eb --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.idx @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind new file mode 100644 index 00000000000..e2bf40975c5 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.ind @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf new file mode 100644 index 00000000000..066fba32940 Binary files /dev/null and b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex new file mode 100644 index 00000000000..b8fdfc2e71b --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/demo4.tex @@ -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} diff --git a/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh b/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh index 678bfa40e78..d0c5961407f 100755 --- a/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh +++ b/Master/texmf-dist/doc/lualatex/xindex/tests/runTests.sh @@ -16,6 +16,10 @@ lualatex demo3 > /dev/null 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 diff --git a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf index 0e0af19097c..f182c409f4e 100644 Binary files a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf and b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex index 8adac4c59c0..25c8c052ca8 100644 --- a/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex +++ b/Master/texmf-dist/doc/lualatex/xindex/xindex-doc.tex @@ -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 @@ Mark Baudoin; Denis Bitouzé; Brian Dunn; Michal Hoftich; +Frank Mittelbach; Heiko Oberdiek; -Matteo Paolini;\\ +Matteo Paolini; Florent Rougon; Martin Sievers; Simon Spiegel @@ -157,7 +157,7 @@ EntryList[2] = { \subsection{Syntax} -The \Index{syntax} is \verb|xindex [...] | where \verb|[...]| are optional \Index{argument}s, either in short or +The \Index{syntax} is \verb|xindex [...] | where \verb|[...]| are optional \Index{argument}s, either in short or long form which, of course, can be mixed: \begin{verbatim} @@ -174,15 +174,38 @@ xindex [-l,--language ] default is en [-p,--prefix] default L [-u,--use_UCA ] default is false - + [-s,--use_stdin ] default is false + (default stdin) file(s)[.idx] one or more files \end{verbatim} For example: \begin{verbatim} xindex -q -l fr -b myDoc +xindex -l de -c DIN2 demo1 demo2 demo3 +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 @@ local args = require ('xindex-lapp') [[ -l,--language (default en) -p,--prefix (default L) -u,--use_UCA - (string) + -s,--use_stdin + (default stdin) [.idx] file(s) ]] \fi diff --git a/Master/texmf-dist/scripts/xindex/xindex.lua b/Master/texmf-dist/scripts/xindex/xindex.lua index fdcbfb21724..3a9655c61d5 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 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 @@ Report bugs to 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 @@ local args = require ('xindex-lapp') [[ -l,--language (default en) -p,--prefix (default L) -u,--use_UCA - (string) + -s,--use_stdin + (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 @@ if (luaVersion < "Lua 5.3") then os.exit() end +useStdInput = args["use_stdin"] + --local inspect = require 'inspect' --print(inspect(args)) @@ -91,46 +93,70 @@ be no log file created. end ]] - ---[[ -if not args["input"] then - io.write ("Filename: ") - inFile = io.read() -else - inFile = args["input"] +require('xindex-baselib') + +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') - -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 +-- print ("Check Logfile:") local filename -local logfilename +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 @@ if vlevel > 0 then 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 @@ outFile = io.open(filename,"w+") writeLog(2,"... done\n",0) writeLog(1,"Starting base file ... \n",2) + BaseRunFile = kpse.find_file("xindex-base.lua") dofile(BaseRunFile) diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua index 0b475ae118d..22167d63c91 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua @@ -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", 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 68e0546e2c5..5a9b114a356 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua index 4748026af05..6df683605f2 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 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,9 +16,21 @@ if pageNoPrefixDel ~= "" then 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) diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua new file mode 100644 index 00000000000..ba1e0d27cce --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua @@ -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 + + 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 927caff925e..18c97ade807 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 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", 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 c057024ddaa..57fb142d743 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua index 8020e4b87a0..5824d12d910 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua index 28cd42daddd..662a0deb9dc 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua index 4e312ce4a04..cb79a0d5502 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua @@ -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 @@ end 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 diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua index cd88fef0c82..906ea00b699 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 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 @@ end -- 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 @@ function replaceAt(str) -- return "bar" from "foo@bar" 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 @@ function UTFCompare(a,b) 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 @@ function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}} -- 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 @@ function getPageList(v,hyperpage) 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 @@ function getItem(str,n) 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,29 +845,6 @@ function getSortString(Entry) 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@foo!world@foo!bar|bar}{60} @@ -973,28 +856,6 @@ 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 - - -- get Unicode category of the codepoint, if supported function getCategory(codepoints) local codepoint = codepoints[1] @@ -1045,3 +906,18 @@ function getSortChar(codepoints) 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 + diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua index 246b295f6a9..c33b89cda36 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua index f8fc65b8bcc..e50e6f0ff8a 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 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", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua index 2ef45e43606..4b1565b2a57 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 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", -- cgit v1.2.3