summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua')
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
index 004c697fdd4..31e4d234260 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.27,
+ version = 0.28,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -846,8 +846,11 @@ end
function itemOutput(last, v, hyperpage)
local lastItems = last
+-- print (tostring("test: "),v["Entry"],lastItems[1],lastItems[2],lastItems[3],type(lastItems[1]),#lastItems)
local currentItems = {}
local Entry = v["Entry"]
+ local mainEntry = getItem(Entry,0) -- save current main letter
+ local lastmainEntry = last[1] -- save last main letter
-- require 'xindex-pretty'.dump(v) -- only for internal dump
local str
local excl = select(2,string.gsub(Entry,"!","!")) -- Number of !
@@ -863,10 +866,11 @@ function itemOutput(last, v, hyperpage)
lastItems[1] = Entry
else
for i = 1,excl+1 do
- currentItems[i] = getItem(Entry,i-1) -- 0 ! 1 ! 2 ! ...
+ currentItems[i] = getItem(Entry,i-1) -- 0 ! 1 ! 2 ! ... mainEntry
local item = "item"
writeLog(1,"itemOutput: currentItems[i]: "..tostring(currentItems[i]).."~= lastItems[i]: "..tostring(lastItems[i]).."\n",2)
- if (currentItems[i] ~= lastItems[i]) then
+ if (currentItems[i] ~= lastItems[i]) or (mainEntry ~= lastmainEntry) -- test if there is a new main entry
+ then
local space = " "
for j = 2,i do
item = "sub"..item -- get the sub...subitem
@@ -878,8 +882,6 @@ function itemOutput(last, v, hyperpage)
str = space.."\\"..item.." "..sublabels[i]..currentItems[i].."\n"
else
str = space.."\\"..item.." "..sublabels[i]..currentItems[i]..itemPageDelimiter.." "..getPageList(v,hyperpage).."\n"
--- set current (sub...)item to empty
- currentItems[i] = ""
end
for i, str0 in ipairs(escape_chars) do -- undo the escape char setting
str = string.gsub(str,str0[2],str0[3])
@@ -887,8 +889,8 @@ function itemOutput(last, v, hyperpage)
outFile:write(str); indLines=indLines+1
else
writeLog(1,"itemOutput: currentItems[i]: "..currentItems[i].."= lastItems[i]: "..lastItems[i].."\n",2)
- lastItems[i] = currentItems[i]
end
+ lastItems[i] = currentItems[i]
end
end
return lastItems