diff options
-rw-r--r-- | ekdosis.dtx | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 941ceed..6b9b15f 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -136,6 +136,9 @@ Running "make install" installs the files in the local TeX tree. | |||
136 | %<*driver> | 136 | %<*driver> |
137 | \documentclass{ltxdoc} | 137 | \documentclass{ltxdoc} |
138 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} | 138 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} |
139 | \usepackage{fontspec} | ||
140 | \usepackage[english]{babel} | ||
141 | \babelfont{rm}{Old Standard} | ||
139 | \usepackage{metalogox} | 142 | \usepackage{metalogox} |
140 | \usepackage{hologo} | 143 | \usepackage{hologo} |
141 | \usepackage{hyperxmp} | 144 | \usepackage{hyperxmp} |
@@ -156,11 +159,6 @@ Running "make install" installs the files in the local TeX tree. | |||
156 | arabtex, luatex}} | 159 | arabtex, luatex}} |
157 | \usepackage[lot]{multitoc} | 160 | \usepackage[lot]{multitoc} |
158 | \usepackage{ekdosis} | 161 | \usepackage{ekdosis} |
159 | \usepackage{fontspec} | ||
160 | \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] | ||
161 | \usepackage{newunicodechar} | ||
162 | \newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ | ||
163 | \newunicodechar{Ǧ}{Ǧ} % | ||
164 | \usepackage{arabluatex} | 162 | \usepackage{arabluatex} |
165 | \usepackage{relsize} | 163 | \usepackage{relsize} |
166 | \usepackage{units} | 164 | \usepackage{units} |
@@ -326,12 +324,6 @@ Running "make install" installs the files in the local TeX tree. | |||
326 | \fi\fi\fi | 324 | \fi\fi\fi |
327 | }{\PackageWarning{ekdosis}{parnotes: erroneous input (ignored)}} | 325 | }{\PackageWarning{ekdosis}{parnotes: erroneous input (ignored)}} |
328 | \newif\iftei@export | 326 | \newif\iftei@export |
329 | % \define@boolkey{ekdosis.sty}[@pkg@]{teiexport}[true]{% | ||
330 | % \if@pkg@teiexport | ||
331 | % \tei@exporttrue | ||
332 | % \AtBeginDocument{\luadirect{ekdosis.openteistream()}}% | ||
333 | % \AtEndDocument{\luadirect{ekdosis.closeteistream()}} | ||
334 | % \else\fi} | ||
335 | \define@choicekey{ekdosis.sty}{teiexport}{true, false, tidy}[true]{% | 327 | \define@choicekey{ekdosis.sty}{teiexport}{true, false, tidy}[true]{% |
336 | \edef\@exptrue{true}\edef\@expfalse{false}\edef\@exptidy{tidy} | 328 | \edef\@exptrue{true}\edef\@expfalse{false}\edef\@exptidy{tidy} |
337 | \edef\@tempa{#1} | 329 | \edef\@tempa{#1} |
@@ -459,13 +451,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
459 | } | 451 | } |
460 | \newcounter{ekd@lab} | 452 | \newcounter{ekd@lab} |
461 | \def\unconditional@appin#1{% | 453 | \def\unconditional@appin#1{% |
462 | \luadirect{ekdosis.appin( | 454 | \luadirect{ekdosis.appin(\luastringN{#1})}% |
463 | \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, | ||
464 | "no")}% | ||
465 | \luadirect{ekdosis.appin(\luastringN{#1}, "no")}% | ||
466 | \luadirect{ekdosis.appin( | ||
467 | \luastring{</\zref@extract{ekd:\theekd@lab}{abspage}>}, | ||
468 | "yes")}% | ||
469 | } | 455 | } |
470 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} | 456 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} |
471 | \newif\ifrtl@app | 457 | \newif\ifrtl@app |
@@ -499,17 +485,11 @@ idno={}, msName={}, origDate={}][3]{% | |||
499 | \NewDocumentCommand{\append@app}{+m}{% | 485 | \NewDocumentCommand{\append@app}{+m}{% |
500 | \ifekd@isinapp% | 486 | \ifekd@isinapp% |
501 | \ifbool{ekd@state}{% | 487 | \ifbool{ekd@state}{% |
502 | \luadirect{ekdosis.appin( | 488 | \luadirect{ekdosis.appin(\luastringO{#1})}% |
503 | \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, | ||
504 | "no")}% | ||
505 | \luadirect{ekdosis.appin(\luastringO{#1}, "no")}% | ||
506 | \luadirect{ekdosis.appin( | ||
507 | \luastring{</\zref@extract{ekd:\theekd@lab}{abspage}>}, | ||
508 | "yes")}% | ||
509 | }{}\else\fi} | 489 | }{}\else\fi} |
510 | \NewDocumentCommand{\append@ln@app}{+m}% | 490 | \NewDocumentCommand{\append@ln@app}{+m}% |
511 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#1}))}} | 491 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#1}))}} |
512 | \NewDocumentCommand{\app}{+m}{% | 492 | \NewDocumentCommand{\app}{ > { \TrimSpaces } +m}{% |
513 | \ekd@isinapptrue% | 493 | \ekd@isinapptrue% |
514 | \stepcounter{ekd@lab}% | 494 | \stepcounter{ekd@lab}% |
515 | \zlabel{ekd:\theekd@lab}% | 495 | \zlabel{ekd:\theekd@lab}% |
@@ -614,7 +594,8 @@ idno={}, msName={}, origDate={}][3]{% | |||
614 | \ifdefined\ekdlr@pre% | 594 | \ifdefined\ekdlr@pre% |
615 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi | 595 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi |
616 | \ltx@ifpackageloaded{babel}% | 596 | \ltx@ifpackageloaded{babel}% |
617 | {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{#2}% | 597 | {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% |
598 | \unexpanded{#2}}% | ||
618 | \ifdefined\ekdlr@post% | 599 | \ifdefined\ekdlr@post% |
619 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi | 600 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi |
620 | \fi | 601 | \fi |
@@ -672,7 +653,8 @@ idno={}, msName={}, origDate={}][3]{% | |||
672 | \ifdefined\ekdlr@pre% | 653 | \ifdefined\ekdlr@pre% |
673 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi | 654 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi |
674 | \ltx@ifpackageloaded{babel}% | 655 | \ltx@ifpackageloaded{babel}% |
675 | {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{#2}% | 656 | {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% |
657 | \unexpanded{#2}}% | ||
676 | \ifdefined\ekdlr@post% | 658 | \ifdefined\ekdlr@post% |
677 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi | 659 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi |
678 | \fi | 660 | \fi |
@@ -1049,8 +1031,8 @@ local function lem_rdg_totei(str) | |||
1049 | bbraces = ekdosis.getsiglum(bbraces, "tei") | 1031 | bbraces = ekdosis.getsiglum(bbraces, "tei") |
1050 | return string.format("%s", bbraces) | 1032 | return string.format("%s", bbraces) |
1051 | end) | 1033 | end) |
1052 | return string.format("<%s wit=\"%s\">%s</%s>", | 1034 | return lem_rdg_totei(string.format("<%s wit=\"%s\">%s</%s>", |
1053 | cmd, opt, arg, cmd) | 1035 | cmd, opt, arg, cmd)) |
1054 | end) | 1036 | end) |
1055 | return str | 1037 | return str |
1056 | end | 1038 | end |
@@ -1386,7 +1368,16 @@ local function mdvisintable(table, value) | |||
1386 | return false | 1368 | return false |
1387 | end | 1369 | end |
1388 | 1370 | ||
1389 | function ekdosis.appin(str, nl) | 1371 | |
1372 | function ekdosis.appin(str) | ||
1373 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | ||
1374 | f:write("<", cur_abs_pg, ">", str, "</", cur_abs_pg, ">\n") | ||
1375 | f:close() | ||
1376 | return true | ||
1377 | end | ||
1378 | |||
1379 | --[[ | ||
1380 | function ekdosis.appin_out(str, nl) | ||
1390 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | 1381 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") |
1391 | if nl == "yes" then | 1382 | if nl == "yes" then |
1392 | f:write(str, "\n") | 1383 | f:write(str, "\n") |
@@ -1396,6 +1387,7 @@ function ekdosis.appin(str, nl) | |||
1396 | f:close() | 1387 | f:close() |
1397 | return true | 1388 | return true |
1398 | end | 1389 | end |
1390 | --]] | ||
1399 | 1391 | ||
1400 | function ekdosis.appout() | 1392 | function ekdosis.appout() |
1401 | local file = io.open(tex.jobname..".ekd", "r") | 1393 | local file = io.open(tex.jobname..".ekd", "r") |
@@ -1404,14 +1396,24 @@ function ekdosis.appout() | |||
1404 | t = f:read("*a") | 1396 | t = f:read("*a") |
1405 | local output = {} | 1397 | local output = {} |
1406 | for i in string.gmatch(t, | 1398 | for i in string.gmatch(t, |
1399 | "<T"..cur_abs_pg..">.-</T"..cur_abs_pg..">") | ||
1400 | do | ||
1401 | table.insert(output, i) | ||
1402 | end | ||
1403 | if string.find(t, "<T"..cur_abs_pg..">") | ||
1404 | then | ||
1405 | table.insert(output, "<T"..cur_abs_pg..">\\par</T"..cur_abs_pg..">") | ||
1406 | else | ||
1407 | end | ||
1408 | for i in string.gmatch(t, | ||
1407 | "<"..cur_abs_pg..">.-</"..cur_abs_pg..">") | 1409 | "<"..cur_abs_pg..">.-</"..cur_abs_pg..">") |
1408 | do | 1410 | do |
1409 | table.insert(output, i) | 1411 | table.insert(output, i) |
1410 | end | 1412 | end |
1411 | f:close() | 1413 | f:close() |
1412 | str = table.concat(output) | 1414 | str = table.concat(output) |
1413 | str = string.gsub(str, "</"..cur_abs_pg..">", "") | 1415 | str = string.gsub(str, "</[A-Z0-9]?"..cur_abs_pg..">", "") |
1414 | str = string.gsub(str, "<"..cur_abs_pg..">", " ") | 1416 | str = string.gsub(str, "<[A-Z0-9]?"..cur_abs_pg..">", " ") |
1415 | return str | 1417 | return str |
1416 | else end | 1418 | else end |
1417 | end | 1419 | end |