diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-31 22:41:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-31 22:41:37 +0000 |
commit | 30095088a5d9797779fc153b90647bed2c3446e0 (patch) | |
tree | c3f3196da8915fec7870dadc26ecad7951b2126f /Master/texmf-dist/tex/lualatex | |
parent | 6c44317e8904afb8ad612d63a792b3bd6b900bf8 (diff) |
xindex (31jan19)
git-svn-id: svn://tug.org/texlive/trunk@49887 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
9 files changed, 81 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua index 65675eab94c..407d903928d 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.06, + version = 0.06b, 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 5c828936189..6b332e308fa 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua @@ -1,5 +1,5 @@ ----------------------------------------------------------------------- --- FILE: xindex-HAdW-eco.lua +-- FILE: xindex-HAdW-eKO.lua -- DESCRIPTION: configuration file for xindex.lua -- REQUIREMENTS: -- AUTHOR: Herbert Voß @@ -8,8 +8,8 @@ -- -- configuration for index files of the Heidelberger Akademie der Wissenschaften -if not modules then modules = { } end modules ['xindex-HAdW'] = { - version = 0.06, +if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = { + version = 0.06b, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -18,7 +18,7 @@ if not modules then modules = { } end modules ['xindex-HAdW'] = { --local version = "0.01" -itemPageDelimiter = "," -- Hello, 14 +itemPageDelimiter = " \\dotfill " -- Hello ..... 14 compressPages = true -- something like 12--15, instaead of 12,13,14,15. the |( ... |) syntax is still valid fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5 minCompress = 3 -- 14--17 or @@ -101,8 +101,7 @@ function specialCompressPageList(pages) --print(#pages..".. number:|"..pages[1]["number"].."| Special:"..pages[1]["special"]) if (pages[1]["number"] == "") then pages[1]["number"] = " " end if (#pages <= 1) then - pages[1]["number"] = pages[1]["number"]:gsub('(.-)-',colorBox)-- replace "-" with ":\\ " --- pages[1]["number"] = pages[1]["number"]:gsub('-',':~')-- replace "-" with ":\\ " + pages[1]["number"] = pages[1]["number"]:gsub('-',':~')-- replace "-" with ":~" return pages end -- only one pageno --[[ @@ -154,16 +153,13 @@ sortPages = {{ origin = { number=VII/1-715, special="" }, Pages[2] = nil -- remove second page return Pages else -- page difference > 1 --- Pages[1]["number"] = pages[1]["number"]:gsub('-',':~') --'(.-)-',colorBox - Pages[1]["number"] = pages[1]["number"]:gsub('(.-)-',colorBox) + Pages[1]["number"] = pages[1]["number"]:gsub('-',':~') Pages[2]["number"] = string.gsub(Pages[2]["number"],'.*-','') -- use only number -> same prefix return Pages -- Pages[1] is the same end else --- Pages[1]["number"] = pages[1]["number"]:gsub('-',':~') --- Pages[2]["number"] = pages[2]["number"]:gsub('-',':~') - Pages[1]["number"] = pages[1]["number"]:gsub('(.-)-',colorBox) - Pages[2]["number"] = pages[2]["number"]:gsub('(.-)-',colorBox) + Pages[1]["number"] = pages[1]["number"]:gsub('-',':~') + Pages[2]["number"] = pages[2]["number"]:gsub('-',':~') return Pages -- different prefix -> simple return of the two pages end else -- more than two pages @@ -192,15 +188,12 @@ sortPages = {{ origin = { number=VII/1-715, special="" }, sortPages = compressPageList(subPageList) -- instead of minus between Roman/Volume and first page insert colon if (stripLeadingSpaces(sortPages[1]["number"]) == "") then --- colon = "" + colon = "" sortPages[1]["number"] = "" - pages[#pages+1] = { number = lastPrefix..sortPages[1]["number"], special = sortPages[1]["special"] } else --- colon = ':~' - pages[#pages+1] = { number = colorBox(lastPrefix)..sortPages[1]["number"], special = sortPages[1]["special"] } + colon = ':~' end --- pages[#pages+1] = { number = lastPrefix..colon..sortPages[1]["number"], special = sortPages[1]["special"] } - pages[#pages+1] = { number = colorBox(lastPrefix)..sortPages[1]["number"], special = sortPages[1]["special"] } + pages[#pages+1] = { number = lastPrefix..colon..sortPages[1]["number"], special = sortPages[1]["special"] } for i=2,#sortPages do pages[#pages+1] = sortPages[i] end @@ -255,4 +248,60 @@ function colorBox(str) return ("\\colorbox{black!15}{"..str.."}:~") end +-- Pages[1]["number"] = pages[1]["number"]:gsub('(.-):~',colorBox) +-- Pages[2]["number"] = pages[2]["number"]:gsub('(.-):~',colorBox) + + +function specialGetPageList(v,hyperpage) + local Pages = {} + if v["pages"] then + table.sort(v["pages"],pageCompare)-- nur nötig, da User manuell eine Zeile einfügen kann + if specialCompressPageList then + Pages = specialCompressPageList(v["pages"]) + else + Pages = compressPageList(v["pages"]) + end +-- require 'xindex-pretty'.dump(Pages) -- only for internal dump + local pageNo +--[[ +\indexentry{Auto|hyperindexformat{\textbf}}{1} +-> \item Auto, \hyperindexformat{\textbf}{1} + + add for example \hyperpage{5\nohyperpage{f}} , same for ff + + \item foo, \hyperpage{1\nohyperpage{f}}, + \hyperpage{4\nohyperpage{ff}}, \hyperpage{8} + +]] + if hyperpage then + if string.find(v["pages"][1]["special"],"hyperindexformat") then + pageNo = v["pages"][1]["special"].."{"..checkFF(Pages[1]["number"].."}") + else + pageNo = "\\hyperpage{"..checkFF(Pages[1]["number"]).."}" + end + for i=2,#Pages do + if string.find(v["pages"][i]["special"],"hyperindexformat") then + pageNo = pageNo..", "..v["pages"][i]["special"].."{"..checkFF(Pages[i]["number"].."}") + else + pageNo = pageNo..", \\hyperpage{"..checkFF(Pages[i]["number"]).."}" + end +-- Pages[i] = nil + end + else + writeLog(1,"getPageList: "..tostring(Pages[1]["special"]).."{"..tostring(Pages[1]["number"]).."}\n",2) + if (Pages[1]["special"] == nil) or (Pages[1]["number"] == nil) then return "" end + pageNo = Pages[1]["special"].."{"..Pages[1]["number"]:gsub('(.-):~',colorBox).."}" + for i=2,#Pages do + if Pages[i]["number"] then + pageNo = pageNo..", "..Pages[i]["special"].."{"..Pages[i]["number"]:gsub('(.-):~',colorBox).."}" + Pages[i] = {} + end + end + end + return pageNo + else + return "" + end +end + diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua index 78a2422bb43..1a6d2878a0d 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua @@ -6,7 +6,7 @@ -- LICENSE: LPPL1.3 ----------------------------------------------------------------------- -local info = { version = 0.06} +local info = { version = 0.06b} -- check config if pageNoPrefixDel ~= "" then @@ -169,7 +169,8 @@ for k=1,#NewIndex do if firstSLine then firstSLine = false if not no_headings then - outFile:write("\\textbf{"..index_header[1].."}\n\\nopagebreak[4]\n") + outFile:write("\\textbf{"..index_header[1].."}") + outFile:write("\\label{"..labelPrefix.."-xindex-"..index_header[1].."}\n\\nopagebreak[4]\n") end end if specialItemOutput then @@ -186,7 +187,8 @@ for k=1,#NewIndex do firstNLine = false outFile:write("\n\\indexspace\n") if not no_headings then - outFile:write("\\textbf{"..index_header[2].."}\n\\nopagebreak[4]\n") + outFile:write("\\textbf{"..index_header[2].."}") + outFile:write("\\label{"..labelPrefix.."-xindex-"..index_header[2].."}\n\\nopagebreak[4]\n") end end if specialItemOutput then @@ -202,7 +204,8 @@ for k=1,#NewIndex do if (currentChar ~= oldChar) and (charType == 2) then outFile:write("\n\\indexspace\n") if not no_headings then - outFile:write("\\textbf{"..currentChar.."}\n\\nopagebreak[4]\n") + outFile:write("\\textbf{"..currentChar.."}") + outFile:write("\\label{"..labelPrefix.."-xindex-"..currentChar.."}\n\\nopagebreak[4]\n") end oldChar = currentChar 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 f988e865169..a280e1a722a 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-common'] = { - version = 0.06, + version = 0.06b, comment = "configuration to xindex.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 1db9fc37b4e..a2ea47f8b22 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.06, + version = 0.06b, 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 e6b68f23fe2..65c5455b8d2 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.06, + version = 0.06b, 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 d640662dd53..29bb9173342 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua @@ -28,7 +28,7 @@ --~ n 2 -------------------------------- if not modules then modules = { } end modules ['xindex-lapp'] = { - version = 0.06, + version = 0.06b, comment = "read parameter for xindex.lua", author = "Steve Donovan", copyright = "Steve Donovan", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua index 8390c9f118b..33911e1f5fc 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.06, + version = 0.06b, comment = "main library 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 38b1dccc479..87f0b777dc9 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua @@ -5,7 +5,7 @@ -- if not modules then modules = { } end modules ['xindex-pretty'] = { - version = 0.06, + version = 0.06b, comment = "dump a Lua table for debugging", author = "Steve Donovan", copyright = "Steve Donovan", |