diff options
author | Robert Alessi <alessi@robertalessi.net> | 2019-09-30 20:27:27 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2019-09-30 20:27:27 +0200 |
commit | 092c5e178ad7fb8c7eb0ea6b7830839ca5c687a7 (patch) | |
tree | e7f04dbe926204d31d79efc2716d5961a2f970e3 | |
parent | 8564f1723d5e0700930f6c3c33426fc83d5f405f (diff) | |
download | ekdosis-092c5e178ad7fb8c7eb0ea6b7830839ca5c687a7.tar.gz |
set different operators for each layer of apparatus. prevent \note from going into the .ekd outfile
-rw-r--r-- | ekdosis.dtx | 121 |
1 files changed, 89 insertions, 32 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index ab3afbb..aac91f8 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -444,6 +444,8 @@ idno={}, msName={}, origDate={}][3]{% | |||
444 | % \begin{macrocode} | 444 | % \begin{macrocode} |
445 | \newif\ifekd@mapps | 445 | \newif\ifekd@mapps |
446 | \NewDocumentCommand{\DeclareApparatus}{m}{ | 446 | \NewDocumentCommand{\DeclareApparatus}{m}{ |
447 | \newbool{subsq@unit@#1} | ||
448 | \booltrue{subsq@unit@#1} | ||
447 | \unless\ifekd@mapps\global\ekd@mappstrue\fi | 449 | \unless\ifekd@mapps\global\ekd@mappstrue\fi |
448 | \luadirect{ekdosis.newapparatus(\luastringN{#1})} | 450 | \luadirect{ekdosis.newapparatus(\luastringN{#1})} |
449 | } | 451 | } |
@@ -514,6 +516,14 @@ idno={}, msName={}, origDate={}][3]{% | |||
514 | \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{% | 516 | \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{% |
515 | \presetkeys[ekd]{appnote}{type=default}{}% | 517 | \presetkeys[ekd]{appnote}{type=default}{}% |
516 | \setkeys[ekd]{appnote}{#1}% | 518 | \setkeys[ekd]{appnote}{#1}% |
519 | \ifekd@mapps% | ||
520 | \ifnum% | ||
521 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} | ||
522 | = 1 | ||
523 | \boolfalse{subsq@unit@\ekdan@type} | ||
524 | \fi% | ||
525 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | ||
526 | \fi% | ||
517 | \ekd@isinapptrue% | 527 | \ekd@isinapptrue% |
518 | \stepcounter{ekd@lab}% | 528 | \stepcounter{ekd@lab}% |
519 | \zlabel{ekd:\theekd@lab}% | 529 | \zlabel{ekd:\theekd@lab}% |
@@ -524,7 +534,8 @@ idno={}, msName={}, origDate={}][3]{% | |||
524 | ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}}, | 534 | ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}}, |
525 | "pg_ii")}% | 535 | "pg_ii")}% |
526 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% | 536 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% |
527 | \ekd@isinappfalse} | 537 | \ekd@isinappfalse% |
538 | \subsq@unittrue} | ||
528 | \def\current@ref@arg#1#2{{\textdir TLT\noexpand\bfseries% | 539 | \def\current@ref@arg#1#2{{\textdir TLT\noexpand\bfseries% |
529 | \ifnum% | 540 | \ifnum% |
530 | \getpagerefnumber{#1} | 541 | \getpagerefnumber{#1} |
@@ -535,6 +546,18 @@ idno={}, msName={}, origDate={}][3]{% | |||
535 | = | 546 | = |
536 | \getrefnumber{#2} | 547 | \getrefnumber{#2} |
537 | % | 548 | % |
549 | \ifekd@mapps% | ||
550 | \ifbool{subsq@unit@\ekdan@type}{% | ||
551 | \ifnum% | ||
552 | \getrefnumber{#1} | ||
553 | = | ||
554 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}} | ||
555 | \else | ||
556 | \getrefnumber{#1}% | ||
557 | \fi% | ||
558 | }% | ||
559 | {\getrefnumber{#1}} | ||
560 | \else | ||
538 | \ifsubsq@unit% | 561 | \ifsubsq@unit% |
539 | % | 562 | % |
540 | \ifnum% | 563 | \ifnum% |
@@ -548,6 +571,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
548 | \else | 571 | \else |
549 | \getrefnumber{#1}% | 572 | \getrefnumber{#1}% |
550 | \fi | 573 | \fi |
574 | \fi | ||
551 | % | 575 | % |
552 | \else | 576 | \else |
553 | \getrefnumber{#1}--% | 577 | \getrefnumber{#1}--% |
@@ -570,6 +594,17 @@ idno={}, msName={}, origDate={}][3]{% | |||
570 | = | 594 | = |
571 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e} | 595 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e} |
572 | % | 596 | % |
597 | \ifekd@mapps% | ||
598 | \ifbool{subsq@unit@\ekdan@type}{% | ||
599 | \ifnum% | ||
600 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b} | ||
601 | = | ||
602 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b} | ||
603 | \else | ||
604 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}% | ||
605 | \fi% | ||
606 | }{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}} | ||
607 | \else | ||
573 | \ifsubsq@unit% | 608 | \ifsubsq@unit% |
574 | % | 609 | % |
575 | \ifnum% | 610 | \ifnum% |
@@ -583,6 +618,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
583 | \else | 618 | \else |
584 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}% | 619 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}% |
585 | \fi | 620 | \fi |
621 | \fi | ||
586 | % | 622 | % |
587 | \else | 623 | \else |
588 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}--% | 624 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}--% |
@@ -606,23 +642,25 @@ idno={}, msName={}, origDate={}][3]{% | |||
606 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% | 642 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% |
607 | \bgroup% | 643 | \bgroup% |
608 | \setkeys[ekd]{lemrdg,lem}{#1}% | 644 | \setkeys[ekd]{lemrdg,lem}{#1}% |
609 | \ifekd@mapps% | ||
610 | \ifnum% | ||
611 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} | ||
612 | = 1 | ||
613 | \subsq@unitfalse% | ||
614 | \fi% | ||
615 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | ||
616 | \fi% | ||
617 | \ifekdl@nolem\edef\lem@app{% | 645 | \ifekdl@nolem\edef\lem@app{% |
618 | \hskip .75em\ifsubsq@unit% | 646 | \hskip .75em |
619 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 647 | \ifekd@mapps |
648 | \ifbool{subsq@unit@\ekdan@type}% | ||
649 | {\unexpanded\expandafter{\ekd@unit@delim}}{}% | ||
650 | \else% | ||
651 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | ||
652 | \fi% | ||
620 | \current@ref\hskip .25em}% | 653 | \current@ref\hskip .25em}% |
621 | \else% | 654 | \else% |
622 | \ifbool{al@rlmode}{% | 655 | \ifbool{al@rlmode}{% |
623 | \edef\lem@app{% | 656 | \edef\lem@app{% |
624 | \hskip .75em\ifsubsq@unit% | 657 | \hskip .75em |
625 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 658 | \ifekd@mapps |
659 | \ifbool{subsq@unit@\ekdan@type}% | ||
660 | {\unexpanded\expandafter{\ekd@unit@delim}}{}% | ||
661 | \else% | ||
662 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | ||
663 | \fi% | ||
626 | \current@ref\hskip .25em | 664 | \current@ref\hskip .25em |
627 | \ifdefined\ekdlr@alt | 665 | \ifdefined\ekdlr@alt |
628 | \ifdefined\ekdlr@post% | 666 | \ifdefined\ekdlr@post% |
@@ -647,8 +685,13 @@ idno={}, msName={}, origDate={}][3]{% | |||
647 | }% | 685 | }% |
648 | {% | 686 | {% |
649 | \edef\lem@app{% | 687 | \edef\lem@app{% |
650 | \hskip .75em\ifsubsq@unit% | 688 | \hskip .75em |
651 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 689 | \ifekd@mapps |
690 | \ifbool{subsq@unit@\ekdan@type}% | ||
691 | {\unexpanded\expandafter{\ekd@unit@delim}}{}% | ||
692 | \else% | ||
693 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | ||
694 | \fi% | ||
652 | \current@ref\hskip .25em | 695 | \current@ref\hskip .25em |
653 | \ifdefined\ekdlr@alt | 696 | \ifdefined\ekdlr@alt |
654 | \ifdefined\ekdlr@pre% | 697 | \ifdefined\ekdlr@pre% |
@@ -683,7 +726,6 @@ idno={}, msName={}, origDate={}][3]{% | |||
683 | \append@ln@app{\lem@app}% | 726 | \append@ln@app{\lem@app}% |
684 | \fi% | 727 | \fi% |
685 | \egroup% | 728 | \egroup% |
686 | \subsq@unittrue% | ||
687 | \ekd@isinlemfalse% | 729 | \ekd@isinlemfalse% |
688 | } | 730 | } |
689 | \NewDocumentCommand{\rdg}{O{} m}{% | 731 | \NewDocumentCommand{\rdg}{O{} m}{% |
@@ -775,7 +817,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
775 | \ifnum% | 817 | \ifnum% |
776 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} | 818 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} |
777 | = 1 | 819 | = 1 |
778 | \subsq@unitfalse% | 820 | \boolfalse{subsq@unit@\ekdan@type} |
779 | \fi% | 821 | \fi% |
780 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | 822 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% |
781 | \fi% | 823 | \fi% |
@@ -786,17 +828,27 @@ idno={}, msName={}, origDate={}][3]{% | |||
786 | set.}\fi% | 828 | set.}\fi% |
787 | \ifbool{al@rlmode}% | 829 | \ifbool{al@rlmode}% |
788 | {\edef\note@contents{% | 830 | {\edef\note@contents{% |
789 | \hskip .75em\ifsubsq@unit% | 831 | \hskip .75em |
790 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 832 | \ifekd@mapps |
791 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em% | 833 | \ifbool{subsq@unit@\ekdan@type}% |
834 | {\unexpanded\expandafter{\ekd@unit@delim}}{}% | ||
835 | \else% | ||
836 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | ||
837 | \fi% | ||
838 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em | ||
792 | \ifdefined\ekdn@lem% | 839 | \ifdefined\ekdn@lem% |
793 | {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}% | 840 | {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}% |
794 | \unexpanded\expandafter{\ekdn@sep}\else\fi% | 841 | \unexpanded\expandafter{\ekdn@sep}\else\fi% |
795 | {\textdir TRT\unexpanded{#2}}}}% | 842 | {\textdir TRT\unexpanded{#2}}}}% |
796 | {\edef\note@contents{% | 843 | {\edef\note@contents{% |
797 | \hskip .75em\ifsubsq@unit% | 844 | \hskip .75em |
798 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 845 | \ifekd@mapps |
799 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em% | 846 | \ifbool{subsq@unit@\ekdan@type}% |
847 | {\unexpanded\expandafter{\ekd@unit@delim}}{}% | ||
848 | \else% | ||
849 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | ||
850 | \fi% | ||
851 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em | ||
800 | \ifdefined\ekdn@lem | 852 | \ifdefined\ekdn@lem |
801 | \ltx@ifpackageloaded{babel}% | 853 | \ltx@ifpackageloaded{babel}% |
802 | {\noexpand\selectlanguage{\languagename}% | 854 | {\noexpand\selectlanguage{\languagename}% |
@@ -829,7 +881,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
829 | }% | 881 | }% |
830 | |\else|% | 882 | |\else|% |
831 | |\append@app|{% | 883 | |\append@app|{% |
832 | |\unskip\footnote|{#1}} | 884 | |\unskip\footnote|{#1}}% |
833 | |\fi|% | 885 | |\fi|% |
834 | } | 886 | } |
835 | \NewDocumentCommand{\note@app}{s O{} +m}{% | 887 | \NewDocumentCommand{\note@app}{s O{} +m}{% |
@@ -843,13 +895,13 @@ idno={}, msName={}, origDate={}][3]{% | |||
843 | }% | 895 | }% |
844 | } | 896 | } |
845 | \NewDocumentCommand{\note}{s O{} +m}{% | 897 | \NewDocumentCommand{\note}{s O{} +m}{% |
846 | \ifekd@isinapp | 898 | \ifekd@isinapp% |
847 | \ifekd@isinlem | 899 | \ifekd@isinlem% |
848 | \note@noapp[#2]{#3}% | 900 | \note@noapp[#2]{#3}% |
849 | \else | 901 | \else% |
850 | \IfBooleanTF{#1}{\note@app*[#2]{#3}}{\note@app[#2]{#3}}% | 902 | \IfBooleanTF{#1}{\note@app*[#2]{#3}}{\note@app[#2]{#3}}% |
851 | \fi | 903 | \fi% |
852 | \else | 904 | \else% |
853 | \note@noapp[#2]{#3}% | 905 | \note@noapp[#2]{#3}% |
854 | \fi% | 906 | \fi% |
855 | } | 907 | } |
@@ -881,7 +933,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
881 | % \fi | 933 | % \fi |
882 | % \StopEventually{} | 934 | % \StopEventually{} |
883 | % \Finale | 935 | % \Finale |
884 | % \iffalse `' | 936 | % \iffalse |
885 | %<*lua> | 937 | %<*lua> |
886 | % \fi | 938 | % \fi |
887 | % \begin{ekdlua} | 939 | % \begin{ekdlua} |
@@ -1740,6 +1792,11 @@ function ekdosis.getprevnotelab() | |||
1740 | return prev_notelab | 1792 | return prev_notelab |
1741 | end | 1793 | end |
1742 | 1794 | ||
1795 | local function remove_note(str) | ||
1796 | str = gsub(str, dblbkslash * lpeg.P("note") * cmdargs, "") | ||
1797 | return str | ||
1798 | end | ||
1799 | |||
1743 | function ekdosis.mdvappend(str, teitype) | 1800 | function ekdosis.mdvappend(str, teitype) |
1744 | if teitype == nil | 1801 | if teitype == nil |
1745 | then | 1802 | then |
@@ -1750,7 +1807,7 @@ function ekdosis.mdvappend(str, teitype) | |||
1750 | "\\linelabel{" .. current_lnlab .. "-e}" | 1807 | "\\linelabel{" .. current_lnlab .. "-e}" |
1751 | .. | 1808 | .. |
1752 | "\\csname append@app\\endcsname{" | 1809 | "\\csname append@app\\endcsname{" |
1753 | .. str .. "}" | 1810 | .. remove_note(str) .. "}" |
1754 | else | 1811 | else |
1755 | return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}" | 1812 | return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}" |
1756 | .. | 1813 | .. |
@@ -1759,7 +1816,7 @@ function ekdosis.mdvappend(str, teitype) | |||
1759 | "\\linelabel{" .. current_lnlab .. "-e}" | 1816 | "\\linelabel{" .. current_lnlab .. "-e}" |
1760 | .. | 1817 | .. |
1761 | "\\csname append@app\\endcsname" .. "[" .. teitype .. "]{" | 1818 | "\\csname append@app\\endcsname" .. "[" .. teitype .. "]{" |
1762 | .. str .. "}" | 1819 | .. remove_note(str) .. "}" |
1763 | end | 1820 | end |
1764 | end | 1821 | end |
1765 | 1822 | ||