diff options
author | Robert Alessi <alessi@robertalessi.net> | 2020-07-06 19:28:09 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2020-07-06 19:28:09 +0200 |
commit | ea7837dfc5fba217c883bd9466979ddd22692cb8 (patch) | |
tree | 1bb57e788f0565208f1ead79e5e4b0a2d0dafea9 | |
parent | 4022ca2d96d70b3e49045060ee83921addb48fd9 (diff) | |
download | ekdosis-ea7837dfc5fba217c883bd9466979ddd22692cb8.tar.gz |
done inserting comments in the Implementation part
-rw-r--r-- | ekdosis.dtx | 123 |
1 files changed, 111 insertions, 12 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index b9cfbaf..70b30ad 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -3355,10 +3355,10 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3355 | } | 3355 | } |
3356 | % \end{macrocode} | 3356 | % \end{macrocode} |
3357 | % \begin{macro}{\note} | 3357 | % \begin{macro}{\note} |
3358 | % Finally, \cs{note} is a simple command designed to check if it is | 3358 | % Finally, \cs{note} is a simple command designed to check whether |
3359 | % found inside or outside \cs{app}. Then, unless it is found inside | 3359 | % \cs{note} itself is called inside or outside \cs{app}. Then, unless |
3360 | % \cs{lem}, it calls \cs{note@app} in the former case and | 3360 | % it is found inside \cs{lem}, it calls \cs{note@app} in the former |
3361 | % \cs{note@noapp} in the latter case:--- | 3361 | % case and \cs{note@noapp} in the latter case:--- |
3362 | % \begin{macrocode} | 3362 | % \begin{macrocode} |
3363 | \NewDocumentCommand{\note}{s O{} +m}{% | 3363 | \NewDocumentCommand{\note}{s O{} +m}{% |
3364 | \ifekd@state% | 3364 | \ifekd@state% |
@@ -3375,19 +3375,35 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3375 | } | 3375 | } |
3376 | % \end{macrocode} | 3376 | % \end{macrocode} |
3377 | % \end{macro} | 3377 | % \end{macro} |
3378 | % \cs{apparatus} is used internally by \pkg{ekdosis} to print the | ||
3379 | % apparatus at the bottom of pages. Therefore, it is not documented, | ||
3380 | % but this may change in the future for it will be possible to have | ||
3381 | % apparatuses printed at other places. | ||
3378 | % \begin{macrocode} | 3382 | % \begin{macrocode} |
3379 | \NewDocumentCommand{\apparatus}{}{% | 3383 | \NewDocumentCommand{\apparatus}{}{% |
3380 | \luadirect{tex.sprint(ekdosis.appout())}} | 3384 | \luadirect{tex.sprint(ekdosis.appout())}} |
3385 | % \end{macrocode} | ||
3386 | % The following two commands call \textsf{Lua} functions to check | ||
3387 | % whether an apparatus should be printed on a given page and to store | ||
3388 | % the current column id. | ||
3389 | % \begin{macrocode} | ||
3381 | \NewDocumentCommand{\test@apparatus}{}{% | 3390 | \NewDocumentCommand{\test@apparatus}{}{% |
3382 | \luadirect{tex.sprint(ekdosis.testapparatus())}} | 3391 | \luadirect{tex.sprint(ekdosis.testapparatus())}} |
3383 | \NewDocumentCommand{\ekd@storecol}{}{% | 3392 | \NewDocumentCommand{\ekd@storecol}{}{% |
3384 | \luadirect{ekdosis.storecurcol(\luastring{\thecolumn})}% | 3393 | \luadirect{ekdosis.storecurcol(\luastring{\thecolumn})}% |
3385 | } | 3394 | } |
3395 | % \end{macrocode} | ||
3396 | % Start and stop |ekdosis|: | ||
3397 | % \begin{macrocode} | ||
3386 | \NewDocumentCommand{\EkdosisOn}{}{% | 3398 | \NewDocumentCommand{\EkdosisOn}{}{% |
3387 | \ekd@statetrue} | 3399 | \ekd@statetrue} |
3388 | \NewDocumentCommand{\EkdosisOff}{}{% | 3400 | \NewDocumentCommand{\EkdosisOff}{}{% |
3389 | \ekd@statefalse% | 3401 | \ekd@statefalse% |
3390 | } | 3402 | } |
3403 | % \end{macrocode} | ||
3404 | % Neutralize unwanted commands provided by \pkg{lineno} within the | ||
3405 | % \env{ekdosis} environment:--- | ||
3406 | % \begin{macrocode} | ||
3391 | \def\ekd@setlineno{% | 3407 | \def\ekd@setlineno{% |
3392 | \let\setpagewiselinenumbers\relax% | 3408 | \let\setpagewiselinenumbers\relax% |
3393 | \let\pagewiselinenumbers\relax% | 3409 | \let\pagewiselinenumbers\relax% |
@@ -3395,15 +3411,27 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3395 | \let\runningpagewiselinenumbers\relax% | 3411 | \let\runningpagewiselinenumbers\relax% |
3396 | \let\realpagewiselinenumbers\relax% | 3412 | \let\realpagewiselinenumbers\relax% |
3397 | } | 3413 | } |
3414 | % \end{macrocode} | ||
3415 | % \begin{environment}{ekdosis} | ||
3416 | % Finally comes the \env{ekdosis} environment meant to receive the | ||
3417 | % edition text equipped with an apparatus criticus. This environment | ||
3418 | % collects its contents and delivers it to \textsf{Lua} functions if a | ||
3419 | % \texttt{TEI xml} output file be desired. | ||
3420 | % \begin{macrocode} | ||
3398 | \NewDocumentEnvironment{ekdosis}{+b}{% | 3421 | \NewDocumentEnvironment{ekdosis}{+b}{% |
3399 | \ekd@setlineno% | 3422 | \ekd@setlineno% |
3400 | \runninglinenumbers | 3423 | \runninglinenumbers |
3401 | \EkdosisOn#1}{% | 3424 | \EkdosisOn#1}{% |
3402 | \EkdosisOff | 3425 | \EkdosisOff |
3403 | \endrunninglinenumbers% | 3426 | \endrunninglinenumbers% |
3404 | \iftei@export\luadirect{ekdosis.exporttei(\luastringN{\par #1\par })}\else\fi} | 3427 | \iftei@export |
3428 | \luadirect{ekdosis.exporttei(\luastringN{\par #1\par })}\fi} | ||
3405 | % \end{macrocode} | 3429 | % \end{macrocode} |
3406 | % Alignment:--- | 3430 | % \end{environment} |
3431 | % \paragraph{Alignment} What follows isto arrange texts in parallel | ||
3432 | % columns either on single pages or on facing pages. | ||
3433 | % | ||
3434 | % Define keys to be used by the \env{alignment} environment:--- | ||
3407 | % \begin{macrocode} | 3435 | % \begin{macrocode} |
3408 | \newif\ifekd@pagelineation | 3436 | \newif\ifekd@pagelineation |
3409 | \ekvdefinekeys{ekd@align}{ | 3437 | \ekvdefinekeys{ekd@align}{ |
@@ -3428,13 +3456,29 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3428 | initial apparatus = edition, | 3456 | initial apparatus = edition, |
3429 | default segmentation = auto | 3457 | default segmentation = auto |
3430 | } | 3458 | } |
3459 | % \end{macrocode} | ||
3460 | % \begin{macro}{\SetEkdosisAlignment} | ||
3461 | % \cs{SetEkdosisAlignment}\marg{settings} can be used either in the | ||
3462 | % preamble or at any point of the document to set or modify the | ||
3463 | % keys-value settings just defined above. | ||
3464 | % \begin{macrocode} | ||
3431 | \NewDocumentCommand{\SetEkdosisAlignment}{m}{ | 3465 | \NewDocumentCommand{\SetEkdosisAlignment}{m}{ |
3432 | \ekvset{ekd@align}{#1} | 3466 | \ekvset{ekd@align}{#1} |
3433 | } | 3467 | } |
3468 | % \end{macrocode} | ||
3469 | % \end{macro} | ||
3470 | % Patch \pkg{paracol} to insert a hook in \cs{pcol@nextpage}. This | ||
3471 | % hook is used to reset line numbers on new pages. | ||
3472 | % \begin{macrocode} | ||
3434 | \patchcmd{\pcol@nextpage}{% | 3473 | \patchcmd{\pcol@nextpage}{% |
3435 | \endgroup}{% | 3474 | \endgroup}{% |
3436 | \ifekd@pagelineation\resetlinenumber\fi | 3475 | \ifekd@pagelineation\resetlinenumber\fi |
3437 | \endgroup}{}{} | 3476 | \endgroup}{}{} |
3477 | % \end{macrocode} | ||
3478 | % \cs{EkdosisColStart} and \cs{EkdosisColStop} initialize columns | ||
3479 | % meant to receive edition texts. These commands are used internally | ||
3480 | % by \pkg{ekdosis}. | ||
3481 | % \begin{macrocode} | ||
3438 | \NewDocumentCommand{\EkdosisColStart}{}{% | 3482 | \NewDocumentCommand{\EkdosisColStart}{}{% |
3439 | \ekd@setlineno% | 3483 | \ekd@setlineno% |
3440 | \runninglinenumbers | 3484 | \runninglinenumbers |
@@ -3456,6 +3500,19 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3456 | "pg_ii")}% | 3500 | "pg_ii")}% |
3457 | \endrunninglinenumbers% | 3501 | \endrunninglinenumbers% |
3458 | } | 3502 | } |
3503 | % \end{macrocode} | ||
3504 | % \begin{environment}{alignment} | ||
3505 | % \cs{begin}|{alignment}|\oarg{options}\dots\cs{end}|{alignment}| can | ||
3506 | % be used as it is provided to typeset a standard critical edition | ||
3507 | % text on the left-hand pages accompanied with a translation on the | ||
3508 | % right-hand pages. To that effect, it provides by default two new | ||
3509 | % environments, \env{edition} and \env{translation}, to be used to | ||
3510 | % typeset both texts. (Either whole texts or texts entered by | ||
3511 | % paragraphs alternately.) The optional argument of \env{aligment} | ||
3512 | % accepts the exact same key-value options as \cs{SetEkdosisAlignment} | ||
3513 | % described above. One may contrast these options with those accepted | ||
3514 | % by \cs{SetEkdosisAlignment} as \enquote{local settings}. | ||
3515 | % \begin{macrocode} | ||
3459 | \NewDocumentEnvironment{alignment}{O{}} | 3516 | \NewDocumentEnvironment{alignment}{O{}} |
3460 | {% | 3517 | {% |
3461 | \ekvset{ekd@align}{#1}% | 3518 | \ekvset{ekd@align}{#1}% |
@@ -3486,7 +3543,20 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3486 | \luadirect{ekdosis.flushcolnums()} | 3543 | \luadirect{ekdosis.flushcolnums()} |
3487 | } | 3544 | } |
3488 | % \end{macrocode} | 3545 | % \end{macrocode} |
3489 | % Divisions of the Body | 3546 | % \end{environment} |
3547 | % \paragraph{Divisions of the Body} | ||
3548 | % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, | ||
3549 | % \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection} | ||
3550 | % into corresponding \texttt{TEI} \enquote*{numbered} | ||
3551 | % |<div|\textsubscript{\emph{n}}|>| elements, where $1\leq n\leq 6$. | ||
3552 | % \begin{macro}{\MkBodyDivs} | ||
3553 | % \cs{MkBodyDivs} is used to let \pkg{ekdosis} know which sectional | ||
3554 | % commands are actually being used in an edition text. This command | ||
3555 | % takes six mandatory arguments. For example, if \cs{section} and | ||
3556 | % \cs{subsection} are the only sectional commands being used, | ||
3557 | % |\MkBodyDivs{section}{subsection}{}{}{}{}| will have \cs{section} | ||
3558 | % and \cs{subsection} converted into |<div1>| and |<div2>| | ||
3559 | % respectively. | ||
3490 | % \begin{macrocode} | 3560 | % \begin{macrocode} |
3491 | \NewDocumentCommand{\MkBodyDivs}{mmmmmm}{ | 3561 | \NewDocumentCommand{\MkBodyDivs}{mmmmmm}{ |
3492 | \luadirect{ekdosis.mkdivdepths( | 3562 | \luadirect{ekdosis.mkdivdepths( |
@@ -3500,7 +3570,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3500 | } | 3570 | } |
3501 | } | 3571 | } |
3502 | % \end{macrocode} | 3572 | % \end{macrocode} |
3503 | % Divisions specific to ekdosis:--- | 3573 | % \end{macro} |
3574 | % Divisions specific to \pkg{ekdosis}. Define keys to be used by | ||
3575 | % \cs{ekddiv}:--- | ||
3504 | % \begin{macrocode} | 3576 | % \begin{macrocode} |
3505 | \ekvdefinekeys{ekd@div}{ | 3577 | \ekvdefinekeys{ekd@div}{ |
3506 | code type = \def\type@value{#1}, | 3578 | code type = \def\type@value{#1}, |
@@ -3521,13 +3593,38 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3521 | \MessageBreak `subsubsection', `paragraph' or `subparagraph'.}, | 3593 | \MessageBreak `subsubsection', `paragraph' or `subparagraph'.}, |
3522 | initial depth = 1 | 3594 | initial depth = 1 |
3523 | } | 3595 | } |
3524 | 3596 | % \end{macrocode} | |
3597 | % \begin{macro}{\ekdfmtdiv} | ||
3598 | % \cs{ekdfmtdiv}\marg{n}\marg{code before}\marg{code after} is | ||
3599 | % used to lay out the heading of the title. It takes three mandatory | ||
3600 | % arguments: \emph{n}, namely the number referring to the particular | ||
3601 | % depth of the division, and then some \LaTeX{} formatting commands | ||
3602 | % to go before and after the heading itself:--- | ||
3603 | % \begin{macrocode} | ||
3525 | \NewDocumentCommand{\ekdfmtdiv}{m m m}{ | 3604 | \NewDocumentCommand{\ekdfmtdiv}{m m m}{ |
3526 | \luadirect{ekdosis.fmtdiv(\luastring{#1}, \luastringN{#2}, \luastringN{#3})} | 3605 | \luadirect{ekdosis.fmtdiv(\luastring{#1}, |
3606 | \luastringN{#2}, | ||
3607 | \luastringN{#3})} | ||
3527 | } | 3608 | } |
3609 | % \end{macrocode} | ||
3610 | % \end{macro} | ||
3611 | % \cs{ekd@getfmtdiv} gets the formatting commands that have been | ||
3612 | % stored by \cs{ekdfmtdiv}. | ||
3613 | % \begin{macrocode} | ||
3528 | \NewDocumentCommand{\ekd@getfmtdiv}{m m}{% | 3614 | \NewDocumentCommand{\ekd@getfmtdiv}{m m}{% |
3529 | \luadirect{tex.sprint(ekdosis.getfmtdiv(\luastringO{#1}, \luastringN{#2}))}% | 3615 | \luadirect{tex.sprint(ekdosis.getfmtdiv(\luastringO{#1}, |
3616 | \luastringN{#2}))}% | ||
3530 | } | 3617 | } |
3618 | % \end{macrocode} | ||
3619 | % \begin{macro}{\ekddiv} | ||
3620 | % \cs{ekddiv}\marg{key-value arguments} is the standard command | ||
3621 | % provided by \pkg{ekdosis} to meet the requirements of classical and | ||
3622 | % literary texts the divisions of which depend on many different | ||
3623 | % received traditions. It takes one optional argument in which the | ||
3624 | % key-value arguments defined above are accepted, and converts the | ||
3625 | % divisions into \texttt{TEI} \enquote*{un-numbered} |<div>| | ||
3626 | % elements. | ||
3627 | % \begin{macrocode} | ||
3531 | \NewDocumentCommand{\ekddiv}{m}{ | 3628 | \NewDocumentCommand{\ekddiv}{m}{ |
3532 | \begingroup | 3629 | \begingroup |
3533 | \ekvset{ekd@div}{#1}% | 3630 | \ekvset{ekd@div}{#1}% |
@@ -3549,7 +3646,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
3549 | \endgroup | 3646 | \endgroup |
3550 | } | 3647 | } |
3551 | % \end{macrocode} | 3648 | % \end{macrocode} |
3552 | % Very basic implementation of poetry lines:--- | 3649 | % \end{macro} |
3650 | % A very basic and provisional implementation of poetry lines | ||
3651 | % follows:--- | ||
3553 | % \begin{macrocode} | 3652 | % \begin{macrocode} |
3554 | \newlength{\ekdverseindentlength} | 3653 | \newlength{\ekdverseindentlength} |
3555 | \setlength{\ekdverseindentlength}{\parindent} | 3654 | \setlength{\ekdverseindentlength}{\parindent} |