aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx38
1 files 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.
149 pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language, 149 pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language,
150 arabtex, luatex}} 150 arabtex, luatex}}
151\usepackage[lot]{multitoc} 151\usepackage[lot]{multitoc}
152%\usepackage{\jobname}
153\usepackage{ekdosis} 152\usepackage{ekdosis}
154\usepackage{fontspec} 153\usepackage{fontspec}
155\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] 154\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}]
@@ -327,7 +326,8 @@ Running "make install" installs the files in the local TeX tree.
327\RequirePackage{keycommand} 326\RequirePackage{keycommand}
328\RequirePackage{xparse} 327\RequirePackage{xparse}
329\RequirePackage{etoolbox} 328\RequirePackage{etoolbox}
330\RequirePackage[addpageno]{lineno} 329\PassOptionsToPackage{addpageno}{lineno}
330\RequirePackage{lineno}
331\RequirePackage{keyfloat} 331\RequirePackage{keyfloat}
332\RequirePackage{refcount} 332\RequirePackage{refcount}
333\RequirePackage{xspace} 333\RequirePackage{xspace}
@@ -341,7 +341,7 @@ Running "make install" installs the files in the local TeX tree.
341\luadirect{dofile(kpse.find_file("ekdosis.lua"))} 341\luadirect{dofile(kpse.find_file("ekdosis.lua"))}
342% \end{macrocode} 342% \end{macrocode}
343% \begin{macrocode} 343% \begin{macrocode}
344\AtEndDocument{\luadirect{closestream()}} 344\AtEndDocument{\luadirect{ekdosis.closestream()}}
345% \end{macrocode} 345% \end{macrocode}
346% \begin{macrocode} 346% \begin{macrocode}
347\newbool{ekd@started} 347\newbool{ekd@started}
@@ -371,10 +371,12 @@ Running "make install" installs the files in the local TeX tree.
371} 371}
372\NewDocumentCommand{\append@app}{+m}{% 372\NewDocumentCommand{\append@app}{+m}{%
373 \ifbool{ekd@state}{% 373 \ifbool{ekd@state}{%
374 \luadirect{appin(\luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, 374 \luadirect{ekdosis.appin(
375 \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>},
375 "no")}% 376 "no")}%
376 \luadirect{appin(\luastringN{#1}, "no")}% 377 \luadirect{ekdosis.appin(\luastringN{#1}, "no")}%
377 \luadirect{appin(\luastring{</\zref@extract{ekd:\theekd@lab}{abspage}>}, 378 \luadirect{ekdosis.appin(
379 \luastring{</\zref@extract{ekd:\theekd@lab}{abspage}>},
378 "yes")}% 380 "yes")}%
379 }{}} 381 }{}}
380\NewDocumentCommand{\append@ln@app}{+m}% 382\NewDocumentCommand{\append@ln@app}{+m}%
@@ -469,7 +471,7 @@ choice nolem={false,,true}][1]{%
469 \if@pkg@parnotes\parnote{#2}% 471 \if@pkg@parnotes\parnote{#2}%
470 \else\footnote{#2}\fi}{ #2\xspace}% 472 \else\footnote{#2}\fi}{ #2\xspace}%
471} 473}
472\NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}} 474\NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(ekdosis.appout())}}
473\NewDocumentCommand{\text@apparatus}{}{% 475\NewDocumentCommand{\text@apparatus}{}{%
474 \luadirect{tex.sprint(ekdosis.testapparatus())}} 476 \luadirect{tex.sprint(ekdosis.testapparatus())}}
475\NewDocumentCommand{\EkdosisStart}{}{% 477\NewDocumentCommand{\EkdosisStart}{}{%
@@ -499,30 +501,26 @@ choice nolem={false,,true}][1]{%
499 501
500ekdosis = {} 502ekdosis = {}
501 503
502function closestream() 504function ekdosis.closestream()
503 os.remove(tex.jobname..".ekd") 505 os.remove(tex.jobname..".ekd")
504 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") 506 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
505 return true 507 return true
506end 508end
507 509
508function remove()
509 os.remove(tex.jobname..".ekd")
510end
511
512local pg_i = 0 510local pg_i = 0
513local pg_ii = 0 511local pg_ii = 0
514local cur_abs_pg = 0 512local cur_abs_pg = 0
515 513
516ekdosis.update_abspg = function(n) 514function ekdosis.update_abspg(n)
517 cur_abs_pg = n 515 cur_abs_pg = n
518 return true 516 return true
519end 517end
520 518
521ekdosis.get_abs_page = function() 519function ekdosis.get_abs_page()
522 return cur_abs_pg 520 return cur_abs_pg
523end 521end
524 522
525ekdosis.storeabspg = function(n, pg) 523function ekdosis.storeabspg(n, pg)
526 if pg == "pg_i" then 524 if pg == "pg_i" then
527 pg_i = n 525 pg_i = n
528 elseif pg == "pg_ii" then 526 elseif pg == "pg_ii" then
@@ -540,14 +538,14 @@ ekdosis.getabspg = function(pg) --not used
540 end 538 end
541end 539end
542 540
543function isintable(table, value) 541local function isintable(table, value)
544 for _, v in pairs(table) do 542 for _, v in pairs(table) do
545 if v == value then return true end 543 if v == value then return true end
546 end 544 end
547 return false 545 return false
548end 546end
549 547
550function appin(str, nl) 548function ekdosis.appin(str, nl)
551 local f = io.open(tex.jobname.."_tmp.ekd", "a+") 549 local f = io.open(tex.jobname.."_tmp.ekd", "a+")
552 if nl == "yes" then 550 if nl == "yes" then
553 f:write(str, "\n") 551 f:write(str, "\n")
@@ -558,7 +556,7 @@ function appin(str, nl)
558 return true 556 return true
559end 557end
560 558
561function appout() 559function ekdosis.appout()
562 local file = io.open(tex.jobname..".ekd", "r") 560 local file = io.open(tex.jobname..".ekd", "r")
563 if file ~= nil then io.close(file) 561 if file ~= nil then io.close(file)
564 f = assert(io.open(tex.jobname..".ekd", "r")) 562 f = assert(io.open(tex.jobname..".ekd", "r"))
@@ -577,7 +575,7 @@ function appout()
577 else end 575 else end
578end 576end
579 577
580ekdosis.testapparatus = function() 578function ekdosis.testapparatus()
581 if pg_ii == pg_i then 579 if pg_ii == pg_i then
582 return "\\boolfalse{do@app}" 580 return "\\boolfalse{do@app}"
583 elseif pg_ii > pg_i then 581 elseif pg_ii > pg_i then
@@ -591,7 +589,7 @@ end
591md5items = {} 589md5items = {}
592local salt = 0 590local salt = 0
593 591
594ekdosis.mdvappend = function(str) 592function ekdosis.mdvappend(str)
595 i = md5.sumhexa(str) 593 i = md5.sumhexa(str)
596 if not isintable(md5items, i) then 594 if not isintable(md5items, i) then
597 table.insert(md5items, i) 595 table.insert(md5items, i)