diff options
-rw-r--r-- | ekdosis.dtx | 141 |
1 files changed, 136 insertions, 5 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index aa47a63..7d757b7 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -453,14 +453,20 @@ idno={}, msName={}, origDate={}][3]{% | |||
453 | \newbool{do@app} | 453 | \newbool{do@app} |
454 | \newif\ifekd@state | 454 | \newif\ifekd@state |
455 | \newif\ifekd@isinapp | 455 | \newif\ifekd@isinapp |
456 | \newif\ifekd@isinlem | ||
456 | \providebool{al@rlmode} | 457 | \providebool{al@rlmode} |
457 | \@ifpackageloaded{arabluatex}{}{% | 458 | \@ifpackageloaded{arabluatex}{}{% |
458 | \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT} | 459 | \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT} |
459 | \def\setLR{\boolfalse{al@rlmode}\pardir TLT \textdir TLT} | 460 | \def\setLR{\boolfalse{al@rlmode}\pardir TLT \textdir TLT} |
460 | } | 461 | } |
461 | \newcounter{ekd@lab} | 462 | \newcounter{ekd@lab} |
462 | \def\unconditional@appin#1{% | 463 | % \def\unconditional@appin#1{% |
463 | \luadirect{ekdosis.appin(\luastringN{#1})}% | 464 | % \luadirect{ekdosis.appin(\luastringN{#1})}% |
465 | % } | ||
466 | \NewDocumentCommand{\unconditional@appin}{o m}{% | ||
467 | \IfNoValueTF{#1} | ||
468 | {\luadirect{ekdosis.appin(\luastringO{#2})}} | ||
469 | {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}% | ||
464 | } | 470 | } |
465 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} | 471 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} |
466 | \newif\ifrtl@app | 472 | \newif\ifrtl@app |
@@ -519,6 +525,41 @@ idno={}, msName={}, origDate={}][3]{% | |||
519 | "pg_ii")}% | 525 | "pg_ii")}% |
520 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% | 526 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% |
521 | \ekd@isinappfalse} | 527 | \ekd@isinappfalse} |
528 | \def\current@ref@arg#1#2{{\textdir TLT\noexpand\bfseries% | ||
529 | \ifnum% | ||
530 | \getpagerefnumber{#1} | ||
531 | = | ||
532 | \getpagerefnumber{#2} | ||
533 | \ifnum% | ||
534 | \getrefnumber{#1} | ||
535 | = | ||
536 | \getrefnumber{#2} | ||
537 | % | ||
538 | \ifsubsq@unit% | ||
539 | % | ||
540 | \ifnum% | ||
541 | \getrefnumber{#1} | ||
542 | = | ||
543 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}} | ||
544 | \else | ||
545 | \getrefnumber{#1}% | ||
546 | \fi | ||
547 | % | ||
548 | \else | ||
549 | \getrefnumber{#1}% | ||
550 | \fi | ||
551 | % | ||
552 | \else | ||
553 | \getrefnumber{#1}--% | ||
554 | \getrefnumber{#2}% | ||
555 | \fi% | ||
556 | \else | ||
557 | \getrefnumber{#1}--% | ||
558 | \getpagerefnumber{#2}.% | ||
559 | \getrefnumber{#2}% | ||
560 | \fi% | ||
561 | } | ||
562 | }% | ||
522 | \def\current@ref{{\textdir TLT\noexpand\bfseries% | 563 | \def\current@ref{{\textdir TLT\noexpand\bfseries% |
523 | \ifnum% | 564 | \ifnum% |
524 | \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} | 565 | \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} |
@@ -561,6 +602,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
561 | \define@boolkeys[ekd]{lem}[ekdl@]{nolem, nosep}[true] | 602 | \define@boolkeys[ekd]{lem}[ekdl@]{nolem, nosep}[true] |
562 | \define@boolkeys[ekd]{rdg}[ekdr@]{nordg}[true] | 603 | \define@boolkeys[ekd]{rdg}[ekdr@]{nordg}[true] |
563 | \NewDocumentCommand{\lem}{O{} m}{% | 604 | \NewDocumentCommand{\lem}{O{} m}{% |
605 | \ekd@isinlemtrue% | ||
564 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% | 606 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% |
565 | \bgroup% | 607 | \bgroup% |
566 | \setkeys[ekd]{lemrdg,lem}{#1}% | 608 | \setkeys[ekd]{lemrdg,lem}{#1}% |
@@ -642,12 +684,21 @@ idno={}, msName={}, origDate={}][3]{% | |||
642 | \fi% | 684 | \fi% |
643 | \egroup% | 685 | \egroup% |
644 | \subsq@unittrue% | 686 | \subsq@unittrue% |
687 | \ekd@isinlemfalse% | ||
645 | } | 688 | } |
646 | \NewDocumentCommand{\rdg}{O{} m}{% | 689 | \NewDocumentCommand{\rdg}{O{} m}{% |
647 | \bgroup% | 690 | \bgroup% |
648 | \setkeys[ekd]{lemrdg,rdg}{#1}% | 691 | \setkeys[ekd]{lemrdg,rdg}{#1}% |
649 | \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If | 692 | % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If |
650 | % so, keep in mind \ifekd@mapps | 693 | % % so, keep in mind \ifekd@mapps, |
694 | % like so: | ||
695 | \ifekdr@nordg% | ||
696 | \ifekd@mapps% | ||
697 | \append@app[\ekdan@type]{}% | ||
698 | \else% | ||
699 | \append@app{}% | ||
700 | \fi% | ||
701 | \else% | ||
651 | \ifbool{al@rlmode}{% | 702 | \ifbool{al@rlmode}{% |
652 | \edef\rdg@app{% | 703 | \edef\rdg@app{% |
653 | \ifdefined\ekdlr@alt | 704 | \ifdefined\ekdlr@alt |
@@ -705,6 +756,55 @@ idno={}, msName={}, origDate={}][3]{% | |||
705 | \fi% | 756 | \fi% |
706 | \egroup% | 757 | \egroup% |
707 | } | 758 | } |
759 | \define@cmdkeys[ekd]{note}[ekdn@]{lem, labelb, labele} | ||
760 | \define@cmdkey[ekd]{note}[ekdn@]{sep}{} | ||
761 | \presetkeys[ekd]{note}{sep=\ekdsep}{} | ||
762 | \NewDocumentCommand{\note@noapp}{O{} +m}{% | ||
763 | \presetkeys[ekd]{appnote}{type=default}{}% | ||
764 | \bgroup% | ||
765 | \setkeys[ekd]{appnote,note}{#1}% | ||
766 | \stepcounter{ekd@lab}% | ||
767 | \zlabel{ekd:\theekd@lab}% | ||
768 | \luadirect{ekdosis.storeabspg( | ||
769 | \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% | ||
770 | \ifekd@state\add@apparatus\fi% | ||
771 | \luadirect{% | ||
772 | ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}}, | ||
773 | "pg_ii")}% | ||
774 | \ifekd@mapps% | ||
775 | \ifnum% | ||
776 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} | ||
777 | = 1 | ||
778 | \subsq@unitfalse% | ||
779 | \fi% | ||
780 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | ||
781 | \fi% | ||
782 | \ifdefined\ekdn@labelb% | ||
783 | \luadirect{tex.sprint(ekdosis.setnotelab(\luastringO{\ekdn@labelb}))}% | ||
784 | \ifdefined\ekdn@labele\else\def\ekdn@labele{\ekdn@labelb}\fi% | ||
785 | \else\PackageError{ekdosis}{missing labelb}{`labelb' must be set.}\fi% | ||
786 | \edef\note@contents{% | ||
787 | \hskip .75em\ifsubsq@unit% | ||
788 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | ||
789 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em% | ||
790 | \ifdefined\ekdn@lem | ||
791 | \ltx@ifpackageloaded{babel}% | ||
792 | {{\noexpand\selectlanguage{\languagename}% | ||
793 | \unexpanded\expandafter{\ekdn@lem}}}% | ||
794 | {\unexpanded\expandafter{\ekdn@lem}}% | ||
795 | \unexpanded\expandafter{\ekdn@sep}\else\fi% | ||
796 | \ltx@ifpackageloaded{babel}% | ||
797 | {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% | ||
798 | \unexpanded{#2}}}% | ||
799 | \ifekd@mapps% | ||
800 | \unconditional@appin[\ekdan@type]{\note@contents}% | ||
801 | \else% | ||
802 | \unconditional@appin{\note@contents}% | ||
803 | \fi% | ||
804 | \luadirect{ekdosis.setprevnotelab(\luastringO{\ekdn@labelb})}% | ||
805 | \egroup% | ||
806 | \subsq@unittrue% | ||
807 | } | ||
708 | \newkeycommand+[\|]{\ekd@note}[pre, post][1]{% | 808 | \newkeycommand+[\|]{\ekd@note}[pre, post][1]{% |
709 | |\append@app|{\ifcommandkey{pre}{\commandkey{pre}}{}% | 809 | |\append@app|{\ifcommandkey{pre}{\commandkey{pre}}{}% |
710 | #1% | 810 | #1% |
@@ -722,7 +822,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
722 | |\unskip\footnote|{#1}} | 822 | |\unskip\footnote|{#1}} |
723 | |\fi|% | 823 | |\fi|% |
724 | } | 824 | } |
725 | \NewDocumentCommand{\note}{s O{} +m}{% | 825 | \NewDocumentCommand{\note@app}{s O{} +m}{% |
726 | \ifbool{al@rlmode}{% | 826 | \ifbool{al@rlmode}{% |
727 | \IfBooleanTF{#1}{\ekd@note@star[#2]{\unexpanded{% | 827 | \IfBooleanTF{#1}{\ekd@note@star[#2]{\unexpanded{% |
728 | {\textdir TRT#3}}}} | 828 | {\textdir TRT#3}}}} |
@@ -732,6 +832,17 @@ idno={}, msName={}, origDate={}][3]{% | |||
732 | {\ekd@note[#2]{\unexpanded{#3}}}% | 832 | {\ekd@note[#2]{\unexpanded{#3}}}% |
733 | }% | 833 | }% |
734 | } | 834 | } |
835 | \NewDocumentCommand{\note}{s O{} +m}{% | ||
836 | \ifekd@isinapp | ||
837 | \ifekd@isinlem | ||
838 | \note@noapp[#2]{#3}% | ||
839 | \else | ||
840 | \IfBooleanTF{#1}{\note@app*[#2]{#3}}{\note@app[#2]{#3}}% | ||
841 | \fi | ||
842 | \else | ||
843 | \note@noapp[#2]{#3}% | ||
844 | \fi% | ||
845 | } | ||
735 | \NewDocumentCommand{\apparatus}{}{% | 846 | \NewDocumentCommand{\apparatus}{}{% |
736 | \luadirect{tex.sprint(ekdosis.appout())}} | 847 | \luadirect{tex.sprint(ekdosis.appout())}} |
737 | \NewDocumentCommand{\test@apparatus}{}{% | 848 | \NewDocumentCommand{\test@apparatus}{}{% |
@@ -1566,6 +1677,8 @@ local lnlabs = {} | |||
1566 | local lnlab_salt = 0 | 1677 | local lnlab_salt = 0 |
1567 | local current_lnlab = nil | 1678 | local current_lnlab = nil |
1568 | local prev_lnlab = nil | 1679 | local prev_lnlab = nil |
1680 | local current_notelab = nil | ||
1681 | local prev_notelab = nil | ||
1569 | local current_lemma = nil | 1682 | local current_lemma = nil |
1570 | local salt = 0 | 1683 | local salt = 0 |
1571 | 1684 | ||
@@ -1599,6 +1712,24 @@ function ekdosis.getprevlnlab() | |||
1599 | return prev_lnlab | 1712 | return prev_lnlab |
1600 | end | 1713 | end |
1601 | 1714 | ||
1715 | function ekdosis.setnotelab(str) | ||
1716 | current_notelab = str | ||
1717 | return "\\linelabel{" .. current_notelab .. "}" | ||
1718 | end | ||
1719 | |||
1720 | function ekdosis.getnotelab() | ||
1721 | return current_notelab | ||
1722 | end | ||
1723 | |||
1724 | function ekdosis.setprevnotelab(str) | ||
1725 | prev_notelab = str | ||
1726 | return true | ||
1727 | end | ||
1728 | |||
1729 | function ekdosis.getprevnotelab() | ||
1730 | return prev_notelab | ||
1731 | end | ||
1732 | |||
1602 | function ekdosis.mdvappend(str, teitype) | 1733 | function ekdosis.mdvappend(str, teitype) |
1603 | if teitype == nil | 1734 | if teitype == nil |
1604 | then | 1735 | then |