#!/usr/bin/env texlua
-----------------------------------------------------------------------
-- FILE: xindex.lua
-- DESCRIPTION: create an index
-- REQUIREMENTS:
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL 1.3
-----------------------------------------------------------------------
xindex = xindex or { }
local version = 0.19
xindex.version = version
--xindex.self = "xindex"
--[[doc--
xindex(1)
This file is provided under the terms of the LPPL v1.3 or
later as printed in full text in the manual (xindex.pdf).
\url{https://ctan.org/license/lppl1.3}.
Report bugs to
\url{https://gitlab.com/hvoss49/xindex/issues}.
--doc]]--
kpse.set_program_name("luatex")
local f = kpse.find_file("lualibs.lua")
print ("Dateiname "..f)
require("lualibs") -- all part of LuaTeX
require('unicode')
require('string')
require("lpeg")
local args = require ('xindex-lapp') [[
parameter handling
-q,--quiet
-h,--help
-v... Verbosity level; can be -v, -vv, -vvv
-c,--config (default cfg)
-e,--escapechar (default ")
-n,--noheadings
-a,--no_casesensitive
-o,--output (default "")
-l,--language (default en)
-p,--prefix (default L)
(string)
]]
--[[
No -v flag, v is just { false }. not args.v[1] is true, so vlevel becomes 0.
One -v flags, v is { true }
Two -v flags, v is { true, true }
Three -v flags, v is { true, true, true }
]]
vlevel = not args.v[1] and 0 or #args.v
not_quiet = not args["quiet"]
local luaVersion = _VERSION
if (luaVersion < "Lua 5.3") then
print("=========================================")
print("Sorry. but we need at least LuaTeX 1.09")
print("Leaving program xindex")
print("=========================================")
os.exit()
end
--local inspect = require 'inspect'
--print(inspect(args))
--[[
if args.h then
print(
Syntax: xinput [options]
By default the Lua program "xindex" creates a so-called
.ind file, which has the same main filename as the input file
unless you are using the option "-o