diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-12-03 18:04:35 +0100 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-12-03 18:04:35 +0100 |
commit | 49c2bc685b2a7442b35ccce753eb146f3f0b76ad (patch) | |
tree | 0096f8b43fcd669c281347375d9fcc7f222b77a9 | |
parent | b2471fdc0b242d98bcdecc25007dd04bcad1e87b (diff) | |
download | ekdosis-49c2bc685b2a7442b35ccce753eb146f3f0b76ad.tar.gz |
store functions in main ekdosis table
-rw-r--r-- | ekdosis.dtx | 38 |
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 | ||
500 | ekdosis = {} | 502 | ekdosis = {} |
501 | 503 | ||
502 | function closestream() | 504 | function 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 |
506 | end | 508 | end |
507 | 509 | ||
508 | function remove() | ||
509 | os.remove(tex.jobname..".ekd") | ||
510 | end | ||
511 | |||
512 | local pg_i = 0 | 510 | local pg_i = 0 |
513 | local pg_ii = 0 | 511 | local pg_ii = 0 |
514 | local cur_abs_pg = 0 | 512 | local cur_abs_pg = 0 |
515 | 513 | ||
516 | ekdosis.update_abspg = function(n) | 514 | function ekdosis.update_abspg(n) |
517 | cur_abs_pg = n | 515 | cur_abs_pg = n |
518 | return true | 516 | return true |
519 | end | 517 | end |
520 | 518 | ||
521 | ekdosis.get_abs_page = function() | 519 | function ekdosis.get_abs_page() |
522 | return cur_abs_pg | 520 | return cur_abs_pg |
523 | end | 521 | end |
524 | 522 | ||
525 | ekdosis.storeabspg = function(n, pg) | 523 | function 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 |
541 | end | 539 | end |
542 | 540 | ||
543 | function isintable(table, value) | 541 | local 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 |
548 | end | 546 | end |
549 | 547 | ||
550 | function appin(str, nl) | 548 | function 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 |
559 | end | 557 | end |
560 | 558 | ||
561 | function appout() | 559 | function 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 |
578 | end | 576 | end |
579 | 577 | ||
580 | ekdosis.testapparatus = function() | 578 | function 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 | |||
591 | md5items = {} | 589 | md5items = {} |
592 | local salt = 0 | 590 | local salt = 0 |
593 | 591 | ||
594 | ekdosis.mdvappend = function(str) | 592 | function 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) |