Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- (find-angg ".emacs" "find-printindex") p = "\171([!-~]+)\187[ \t]*%(to[ \t]+\"(.*)\"%)" toindexline = function (anchor, pre, width) pre = pre or "% " width = width or 40 local l = pre .. format("\171.%s\187", anchor) local r = format("(to \"%s\")", anchor) return format("%-"..width.."s%s", l, r) end printindex = function (lines) for _,li in ipairs(lines) do local a,b = li:match(p) if a and "." .. a == b then print(toindexline(a)) end end end if arg and arg[1] == "-e" then assert(loadstring(arg[2]))() end if arg and arg[1] == "-i" then printindex(splitlines(readfile(arg[2]))) end