From 49c2bc685b2a7442b35ccce753eb146f3f0b76ad Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 3 Dec 2018 18:04:35 +0100 Subject: store functions in main ekdosis table --- ekdosis.dtx | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 5c1c875..672b228 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -149,7 +149,6 @@ Running "make install" installs the files in the local TeX tree. pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language, arabtex, luatex}} \usepackage[lot]{multitoc} -%\usepackage{\jobname} \usepackage{ekdosis} \usepackage{fontspec} \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] @@ -327,7 +326,8 @@ Running "make install" installs the files in the local TeX tree. \RequirePackage{keycommand} \RequirePackage{xparse} \RequirePackage{etoolbox} -\RequirePackage[addpageno]{lineno} +\PassOptionsToPackage{addpageno}{lineno} +\RequirePackage{lineno} \RequirePackage{keyfloat} \RequirePackage{refcount} \RequirePackage{xspace} @@ -341,7 +341,7 @@ Running "make install" installs the files in the local TeX tree. \luadirect{dofile(kpse.find_file("ekdosis.lua"))} % \end{macrocode} % \begin{macrocode} -\AtEndDocument{\luadirect{closestream()}} +\AtEndDocument{\luadirect{ekdosis.closestream()}} % \end{macrocode} % \begin{macrocode} \newbool{ekd@started} @@ -371,10 +371,12 @@ Running "make install" installs the files in the local TeX tree. } \NewDocumentCommand{\append@app}{+m}{% \ifbool{ekd@state}{% - \luadirect{appin(\luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, + \luadirect{ekdosis.appin( + \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, "no")}% - \luadirect{appin(\luastringN{#1}, "no")}% - \luadirect{appin(\luastring{}, + \luadirect{ekdosis.appin(\luastringN{#1}, "no")}% + \luadirect{ekdosis.appin( + \luastring{}, "yes")}% }{}} \NewDocumentCommand{\append@ln@app}{+m}% @@ -469,7 +471,7 @@ choice nolem={false,,true}][1]{% \if@pkg@parnotes\parnote{#2}% \else\footnote{#2}\fi}{ #2\xspace}% } -\NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}} +\NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(ekdosis.appout())}} \NewDocumentCommand{\text@apparatus}{}{% \luadirect{tex.sprint(ekdosis.testapparatus())}} \NewDocumentCommand{\EkdosisStart}{}{% @@ -499,30 +501,26 @@ choice nolem={false,,true}][1]{% ekdosis = {} -function closestream() +function ekdosis.closestream() os.remove(tex.jobname..".ekd") os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") return true end -function remove() - os.remove(tex.jobname..".ekd") -end - local pg_i = 0 local pg_ii = 0 local cur_abs_pg = 0 -ekdosis.update_abspg = function(n) +function ekdosis.update_abspg(n) cur_abs_pg = n return true end -ekdosis.get_abs_page = function() +function ekdosis.get_abs_page() return cur_abs_pg end -ekdosis.storeabspg = function(n, pg) +function ekdosis.storeabspg(n, pg) if pg == "pg_i" then pg_i = n elseif pg == "pg_ii" then @@ -540,14 +538,14 @@ ekdosis.getabspg = function(pg) --not used end end -function isintable(table, value) +local function isintable(table, value) for _, v in pairs(table) do if v == value then return true end end return false end -function appin(str, nl) +function ekdosis.appin(str, nl) local f = io.open(tex.jobname.."_tmp.ekd", "a+") if nl == "yes" then f:write(str, "\n") @@ -558,7 +556,7 @@ function appin(str, nl) return true end -function appout() +function ekdosis.appout() local file = io.open(tex.jobname..".ekd", "r") if file ~= nil then io.close(file) f = assert(io.open(tex.jobname..".ekd", "r")) @@ -577,7 +575,7 @@ function appout() else end end -ekdosis.testapparatus = function() +function ekdosis.testapparatus() if pg_ii == pg_i then return "\\boolfalse{do@app}" elseif pg_ii > pg_i then @@ -591,7 +589,7 @@ end md5items = {} local salt = 0 -ekdosis.mdvappend = function(str) +function ekdosis.mdvappend(str) i = md5.sumhexa(str) if not isintable(md5items, i) then table.insert(md5items, i) -- cgit v1.2.3