diff options
author | Robert Alessi <alessi@robertalessi.net> | 2020-06-12 17:32:36 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2020-06-12 17:32:36 +0200 |
commit | 4c32ae07a868015986b6a9e1912302cc10c1726d (patch) | |
tree | b9983a4a0cdc1b9de608c76725236b3f4ad03587 | |
parent | 66a3577bf279ef34458035d41f8727b6f58cf95d (diff) | |
download | ekdosis-4c32ae07a868015986b6a9e1912302cc10c1726d.tar.gz |
set line number font to \normalfont. new option 'flush' added to alignment. new command \EkdosisDefaultApparatus. started preparing files for documentation
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | ekdosis.dtx | 209 | ||||
-rw-r--r-- | ekdosis.ins | 10 |
3 files changed, 209 insertions, 28 deletions
@@ -6,37 +6,49 @@ VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//') | |||
6 | LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) | 6 | LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) |
7 | UTREE = $(shell kpsewhich --var-value TEXMFHOME) | 7 | UTREE = $(shell kpsewhich --var-value TEXMFHOME) |
8 | HOMEDIR := $$HOME | 8 | HOMEDIR := $$HOME |
9 | all: $(NAME).pdf | 9 | |
10 | all: sty $(NAME).pdf | ||
10 | test -e README.txt && mv README.txt README || exit 0 | 11 | test -e README.txt && mv README.txt README || exit 0 |
12 | |||
13 | sty: clean | ||
14 | $(CMP) $(NAME).ins | ||
15 | |||
11 | $(NAME).pdf: $(NAME).dtx | 16 | $(NAME).pdf: $(NAME).dtx |
17 | $(CMP) --shell-escape -recorder -interaction=batchmode $(NAME)-ex.tex >/dev/null | ||
12 | $(CMP) --shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null | 18 | $(CMP) --shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null |
13 | if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi | 19 | if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi |
14 | if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi | 20 | if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi |
15 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null | 21 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null |
16 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null | 22 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null |
23 | |||
17 | clean: | 24 | clean: |
18 | rm -rf _minted-* | 25 | rm -rf _minted-* |
19 | rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,log,out,toc,pyg} | 26 | rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,log,out,toc,pyg} |
20 | rm -f *~ | 27 | rm -f *~ |
21 | rm -rf auto/ | 28 | rm -rf auto/ |
22 | # rm -f $(NAME)_*.{bib,lua} | 29 | # rm -f $(NAME)_*.{bib,lua} |
30 | |||
23 | auctex: | 31 | auctex: |
24 | if [ ! -d "$(HOMEDIR)/.emacs.d/auctex/auto" ]; then \ | 32 | if [ ! -d "$(HOMEDIR)/.emacs.d/auctex/auto" ]; then \ |
25 | mkdir -p $(HOMEDIR)/.emacs.d/auctex/auto; \ | 33 | mkdir -p $(HOMEDIR)/.emacs.d/auctex/auto; \ |
26 | fi | 34 | fi |
27 | cp $(NAME)*.el $(HOMEDIR)/.emacs.d/auctex/auto | 35 | cp $(NAME)*.el $(HOMEDIR)/.emacs.d/auctex/auto |
36 | |||
28 | distclean: clean uninst | 37 | distclean: clean uninst |
29 | rm -f $(NAME).{pdf,sty,lua} README* | 38 | rm -f $(NAME).{pdf,sty,lua,ekd} $(NAME)-ex*.* README* |
30 | rm -f *.zip *.tar.gz | 39 | rm -f *.zip *.tar.gz |
40 | |||
31 | uninst: | 41 | uninst: |
32 | rm -rf $(UTREE)/{tex,source,doc}/lualatex/$(NAME) | 42 | rm -rf $(UTREE)/{tex,source,doc}/lualatex/$(NAME) |
33 | rm -rf $(HOMEDIR)/.emacs.d/auctex/auto/$(NAME).{el,elc} | 43 | rm -rf $(HOMEDIR)/.emacs.d/auctex/auto/$(NAME).{el,elc} |
44 | |||
34 | inst: uninst auctex all | 45 | inst: uninst auctex all |
35 | mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) | 46 | mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) |
36 | cp $(NAME).dtx $(UTREE)/source/lualatex/$(NAME) | 47 | cp $(NAME).dtx $(UTREE)/source/lualatex/$(NAME) |
37 | cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) | 48 | cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) |
38 | cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) | 49 | cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) |
39 | cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) | 50 | cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) |
51 | |||
40 | local: uninst auctex | 52 | local: uninst auctex |
41 | $(CMP) $(NAME).ins | 53 | $(CMP) $(NAME).ins |
42 | mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) | 54 | mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) |
@@ -47,10 +59,12 @@ local: uninst auctex | |||
47 | # sudo cp $(NAME).dtx $(LOCAL)/source/lualatex/$(NAME) | 59 | # sudo cp $(NAME).dtx $(LOCAL)/source/lualatex/$(NAME) |
48 | # sudo cp $(NAME).sty $(LOCAL)/tex/lualatex/$(NAME) | 60 | # sudo cp $(NAME).sty $(LOCAL)/tex/lualatex/$(NAME) |
49 | # sudo cp $(NAME).pdf $(LOCAL)/doc/lualatex/$(NAME) | 61 | # sudo cp $(NAME).pdf $(LOCAL)/doc/lualatex/$(NAME) |
62 | |||
50 | zip: all | 63 | zip: all |
51 | ln -sf . $(NAME) | 64 | ln -sf . $(NAME) |
52 | zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{README,$(NAME).{pdf,sty,lua,el}} | 65 | zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{README,$(NAME).{pdf,sty,lua,el}} |
53 | rm $(NAME) | 66 | rm $(NAME) |
67 | |||
54 | package: distclean all | 68 | package: distclean all |
55 | mkdir $(NAME)/ | 69 | mkdir $(NAME)/ |
56 | cp README *.dtx *.pdf $(NAME)/ | 70 | cp README *.dtx *.pdf $(NAME)/ |
diff --git a/ekdosis.dtx b/ekdosis.dtx index 6f77144..e0ad014 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -104,6 +104,16 @@ Running "make install" installs the files in the local TeX tree. | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | \egroup | 106 | \egroup |
107 | \usedir{doc/lualatex/ekdosis} | ||
108 | \generate{ | ||
109 | \file{ekdosis-ex.tex}{ | ||
110 | \from{\jobname.dtx}{examples} | ||
111 | } | ||
112 | } | ||
113 | \usedir{doc/lualatex/ekdosis} | ||
114 | \generate{ | ||
115 | \file{README.txt}{\from{\jobname.dtx}{readme}} | ||
116 | } | ||
107 | %</install> | 117 | %</install> |
108 | %<install>\endbatchfile | 118 | %<install>\endbatchfile |
109 | %<*internal> | 119 | %<*internal> |
@@ -146,6 +156,8 @@ Running "make install" installs the files in the local TeX tree. | |||
146 | \babelfont{tt}{NewComputerModern Mono} | 156 | \babelfont{tt}{NewComputerModern Mono} |
147 | \usepackage{metalogox} | 157 | \usepackage{metalogox} |
148 | \usepackage{hologo} | 158 | \usepackage{hologo} |
159 | \usepackage{xcolor} | ||
160 | \definecolor{ekdcolor}{RGB}{243,241,235} | ||
149 | \usepackage{latexcolors} | 161 | \usepackage{latexcolors} |
150 | \usepackage{hyperxmp} | 162 | \usepackage{hyperxmp} |
151 | \usepackage{uri} | 163 | \usepackage{uri} |
@@ -168,15 +180,36 @@ Running "make install" installs the files in the local TeX tree. | |||
168 | \usepackage{arabluatex} | 180 | \usepackage{arabluatex} |
169 | \usepackage{relsize} | 181 | \usepackage{relsize} |
170 | \usepackage{units} | 182 | \usepackage{units} |
171 | \usepackage[newfloat=true]{minted} | 183 | \PassOptionsToPackage{newfloat}{minted} |
172 | \newminted[ekdlua]{lua}{linenos, fontsize=\relsize{-0.5}, | 184 | \usepackage{tikz} |
173 | xleftmargin=12pt, breaklines, | 185 | \usepackage[breakable, skins, xparse, minted]{tcolorbox} |
174 | numberblanklines=false, numbersep=3pt, firstnumber=last} | 186 | \usepackage{minted} |
187 | \setminted{bgcolor=ekdcolor,linenos, fontsize=\small} | ||
188 | \newminted[ekdlua]{lua}{ | ||
189 | bgcolor={}, | ||
190 | linenos, | ||
191 | fontsize=\relsize{-0.5}, | ||
192 | xleftmargin=12pt, | ||
193 | breaklines, | ||
194 | numberblanklines=false, | ||
195 | numbersep=3pt, | ||
196 | firstnumber=last} | ||
175 | \renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}} | 197 | \renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}} |
176 | \usepackage[contents]{colordoc} | 198 | \usepackage[contents]{colordoc} |
177 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} | 199 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} |
178 | \usepackage{tikz} | 200 | % |
179 | \usepackage[breakable, skins, xparse, minted]{tcolorbox} | 201 | \backgroundcolor{c}{ekdcolor} |
202 | \usepackage{caption} | ||
203 | \captionsetup[listing]{position=above,skip=-1ex} | ||
204 | \usepackage{needspace} | ||
205 | \NewDocumentCommand{\captof}{O{listing} m O{}}{% | ||
206 | \bgroup | ||
207 | \needspace{2\baselineskip}% | ||
208 | \vskip 1ex plus 2pt minus 2pt% | ||
209 | \captionof{#1}{#2}% | ||
210 | #3% | ||
211 | \egroup} | ||
212 | % | ||
180 | \usepackage{etoc} | 213 | \usepackage{etoc} |
181 | \etocsettocdepth{paragraph} | 214 | \etocsettocdepth{paragraph} |
182 | \newcommand{\ekdtableofcontents}{% | 215 | \newcommand{\ekdtableofcontents}{% |
@@ -289,8 +322,20 @@ Running "make install" installs the files in the local TeX tree. | |||
289 | % -- (0,2); | 322 | % -- (0,2); |
290 | % \end{tikzpicture} | 323 | % \end{tikzpicture} |
291 | % \end{keyfigure} | 324 | % \end{keyfigure} |
325 | % | ||
326 | % %*** | ||
327 | % \captof{Peter and John example} | ||
328 | % \inputminted[firstline=17,lastline=24]{latex}{ekdosis-ex.tex} | ||
329 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | ||
330 | % \begin{specimen} | ||
331 | % I saw my friend \app{ | ||
332 | % \lem{Peter} | ||
333 | % \rdg{John}} | ||
334 | % at the station yesterday. | ||
335 | % \end{specimen} | ||
336 | % \end{alignment} | ||
337 | % \inputminted[firstline=35,lastline=39]{xml}{ekdosis-ex-tei.xml} | ||
292 | % | 338 | % |
293 | % \StopEventually{} | ||
294 | % \section{Implementation} | 339 | % \section{Implementation} |
295 | % | 340 | % |
296 | % \iffalse | 341 | % \iffalse |
@@ -385,6 +430,10 @@ Running "make install" installs the files in the local TeX tree. | |||
385 | \luadirect{ekdosis.closestream()} | 430 | \luadirect{ekdosis.closestream()} |
386 | } | 431 | } |
387 | % \end{macrocode} | 432 | % \end{macrocode} |
433 | % General settings | ||
434 | % \begin{macrocode} | ||
435 | \renewcommand\linenumberfont{\normalfont\footnotesize} | ||
436 | % \end{macrocode} | ||
388 | % Hooks | 437 | % Hooks |
389 | % \begin{macrocode} | 438 | % \begin{macrocode} |
390 | \ekvdefinekeys{ekd@hooks}{ | 439 | \ekvdefinekeys{ekd@hooks}{ |
@@ -645,10 +694,18 @@ Running "make install" installs the files in the local TeX tree. | |||
645 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}))}} | 694 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}))}} |
646 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}, | 695 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}, |
647 | \luastringO{#1}))}}} | 696 | \luastringO{#1}))}}} |
648 | \define@cmdkey[ekd]{appnote}[ekdan@]{type}{} | 697 | % \define@cmdkey[ekd]{appnote}[ekdan@]{type}[default]{} |
698 | \ekvdefinekeys{appnote}{ | ||
699 | store type = \ekdan@type, | ||
700 | initial type = default | ||
701 | } | ||
702 | \NewDocumentCommand{\EkdosisDefaultApparatus}{m}{% | ||
703 | \ekvset{appnote}{type=#1}} | ||
649 | \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{% | 704 | \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{% |
650 | \presetkeys[ekd]{appnote}{type=default}{}% | 705 | % \presetkeys[ekd]{appnote}{type=default}{}% |
651 | \setkeys[ekd]{appnote}{#1}% | 706 | % \setkeys[ekd]{appnote}{#1}% |
707 | \begingroup | ||
708 | \ekvset{appnote}{#1}% | ||
652 | \ekd@isinapptrue% | 709 | \ekd@isinapptrue% |
653 | \stepcounter{ekd@lab}% | 710 | \stepcounter{ekd@lab}% |
654 | \zlabel{ekd:\theekd@lab}% | 711 | \zlabel{ekd:\theekd@lab}% |
@@ -656,7 +713,8 @@ Running "make install" installs the files in the local TeX tree. | |||
656 | \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% | 713 | \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% |
657 | \ifekd@state\add@apparatus\fi% | 714 | \ifekd@state\add@apparatus\fi% |
658 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% | 715 | \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% |
659 | \ekd@isinappfalse} | 716 | \ekd@isinappfalse% |
717 | \endgroup} | ||
660 | \def\current@ref@arg#1#2{{%\textdir TLT% | 718 | \def\current@ref@arg#1#2{{%\textdir TLT% |
661 | \unexpanded\expandafter{\ekd@refnumstyle}% | 719 | \unexpanded\expandafter{\ekd@refnumstyle}% |
662 | \ifnum% | 720 | \ifnum% |
@@ -932,13 +990,23 @@ Running "make install" installs the files in the local TeX tree. | |||
932 | \fi% | 990 | \fi% |
933 | \egroup% | 991 | \egroup% |
934 | } | 992 | } |
935 | \define@cmdkeys[ekd]{note}[ekdn@]{lem, labelb, labele} | 993 | % \define@cmdkeys[ekd]{note}[ekdn@]{lem, labelb, labele} |
936 | \define@cmdkey[ekd]{note}[ekdn@]{sep}{} | 994 | % \define@cmdkey[ekd]{note}[ekdn@]{sep}{} |
937 | \presetkeys[ekd]{note}{sep=\ekdsep}{} | 995 | % \presetkeys[ekd]{note}{sep=\ekdsep}{} |
996 | \ekvdefinekeys{note}{ | ||
997 | store type = \ekdan@type, | ||
998 | store lem = \ekdn@lem, | ||
999 | code labelb = \def\ekdn@labelb{#1}, | ||
1000 | code labele = \def\ekdn@labele{#1}, | ||
1001 | store sep = \ekdn@sep, | ||
1002 | initial type = default, | ||
1003 | initial sep = \ekdsep | ||
1004 | } | ||
938 | \NewDocumentCommand{\note@noapp}{O{} +m}{% | 1005 | \NewDocumentCommand{\note@noapp}{O{} +m}{% |
939 | \presetkeys[ekd]{appnote}{type=default}{}% | 1006 | % \presetkeys[ekd]{appnote}{type=default}{}% |
940 | \bgroup% | 1007 | \bgroup% |
941 | \setkeys[ekd]{appnote,note}{#1}% | 1008 | \ekvset{note}{#1} |
1009 | % \setkeys[ekd]{appnote,note}{#1}% | ||
942 | \stepcounter{ekd@lab}% | 1010 | \stepcounter{ekd@lab}% |
943 | \zlabel{ekd:\theekd@lab}% | 1011 | \zlabel{ekd:\theekd@lab}% |
944 | \luadirect{ekdosis.storeabspg( | 1012 | \luadirect{ekdosis.storeabspg( |
@@ -1097,6 +1165,7 @@ Running "make install" installs the files in the local TeX tree. | |||
1097 | bool pagelineation = \ifekd@pagelineation, | 1165 | bool pagelineation = \ifekd@pagelineation, |
1098 | choice segmentation = {auto = \def\segmentation@val{auto}, | 1166 | choice segmentation = {auto = \def\segmentation@val{auto}, |
1099 | noauto = \def\segmentation@val{noauto}}, | 1167 | noauto = \def\segmentation@val{noauto}}, |
1168 | bool flush = \ifekd@flushapp, | ||
1100 | initial tcols = 2, | 1169 | initial tcols = 2, |
1101 | initial lcols = 1, | 1170 | initial lcols = 1, |
1102 | initial texts = edition;translation, | 1171 | initial texts = edition;translation, |
@@ -1138,6 +1207,9 @@ Running "make install" installs the files in the local TeX tree. | |||
1138 | \luastring{\texts@value}, | 1207 | \luastring{\texts@value}, |
1139 | "texts" | 1208 | "texts" |
1140 | )} | 1209 | )} |
1210 | \ifekd@flushapp | ||
1211 | \luadirect{ekdosis.newalignment("set")} | ||
1212 | \fi | ||
1141 | \luadirect{ekdosis.mkenvdata( | 1213 | \luadirect{ekdosis.mkenvdata( |
1142 | \luastring{\apparatus@value}, "apparatus" | 1214 | \luastring{\apparatus@value}, "apparatus" |
1143 | )} | 1215 | )} |
@@ -1151,6 +1223,9 @@ Running "make install" installs the files in the local TeX tree. | |||
1151 | } | 1223 | } |
1152 | {\end{paracol} | 1224 | {\end{paracol} |
1153 | \iftei@export\luadirect{ekdosis.export_coldata_totei()}\fi | 1225 | \iftei@export\luadirect{ekdosis.export_coldata_totei()}\fi |
1226 | \ifekd@flushapp | ||
1227 | \luadirect{ekdosis.newalignment("reset")} | ||
1228 | \fi | ||
1154 | \luadirect{ekdosis.flushenvdata()} | 1229 | \luadirect{ekdosis.flushenvdata()} |
1155 | \luadirect{ekdosis.flushcolnums()} | 1230 | \luadirect{ekdosis.flushcolnums()} |
1156 | } | 1231 | } |
@@ -2327,7 +2402,7 @@ local curcol = "x" | |||
2327 | 2402 | ||
2328 | local check_resetlineno = {} | 2403 | local check_resetlineno = {} |
2329 | 2404 | ||
2330 | function ekdosis.update_abspg(n) | 2405 | function ekdosis.update_abspg(n) -- not used |
2331 | cur_abs_pg = n | 2406 | cur_abs_pg = n |
2332 | return true | 2407 | return true |
2333 | end | 2408 | end |
@@ -2356,6 +2431,27 @@ end | |||
2356 | -- Build environments to be aligned | 2431 | -- Build environments to be aligned |
2357 | -- | 2432 | -- |
2358 | 2433 | ||
2434 | local cur_alignment = "-" | ||
2435 | local cur_alignment_patt = "%-" | ||
2436 | local cur_alignment_cnt = 1 | ||
2437 | |||
2438 | local newalignment = false | ||
2439 | function ekdosis.newalignment(str) | ||
2440 | if str == "set" | ||
2441 | then | ||
2442 | newalignment = true | ||
2443 | cur_alignment = "-"..cur_alignment_cnt.."-" | ||
2444 | cur_alignment_patt = "%-"..cur_alignment_cnt.."%-" | ||
2445 | cur_alignment_cnt = cur_alignment_cnt + 1 | ||
2446 | elseif str == "reset" | ||
2447 | then | ||
2448 | newalignment = false | ||
2449 | cur_alignment = "-" | ||
2450 | cur_alignment_patt = "-" | ||
2451 | end | ||
2452 | return true | ||
2453 | end | ||
2454 | |||
2359 | local aligned_texts = {} | 2455 | local aligned_texts = {} |
2360 | local texts_w_apparatus = {} | 2456 | local texts_w_apparatus = {} |
2361 | local coldata_totei = {} | 2457 | local coldata_totei = {} |
@@ -2620,7 +2716,8 @@ function ekdosis.appin(str, teitype) | |||
2620 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | 2716 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") |
2621 | if next(apparatuses) == nil | 2717 | if next(apparatuses) == nil |
2622 | then | 2718 | then |
2623 | f:write("<", cur_abs_pg, "-", curcol, "-0>", str, "</", cur_abs_pg, "-", curcol, "-0>\n") | 2719 | f:write("<", cur_abs_pg, cur_alignment, curcol, "-0>", str, "</", |
2720 | cur_abs_pg, cur_alignment, curcol, "-0>\n") | ||
2624 | else | 2721 | else |
2625 | for i = 1,#apparatuses | 2722 | for i = 1,#apparatuses |
2626 | do | 2723 | do |
@@ -2629,7 +2726,8 @@ function ekdosis.appin(str, teitype) | |||
2629 | break | 2726 | break |
2630 | end | 2727 | end |
2631 | end | 2728 | end |
2632 | f:write("<", cur_abs_pg, "-", curcol, "-", appno, ">", str, "</", cur_abs_pg, "-", curcol, "-", appno, ">\n") | 2729 | f:write("<", cur_abs_pg, cur_alignment, curcol, "-", |
2730 | appno, ">", str, "</", cur_abs_pg, cur_alignment, curcol, "-", appno, ">\n") | ||
2633 | end | 2731 | end |
2634 | f:close() | 2732 | f:close() |
2635 | return true | 2733 | return true |
@@ -2646,7 +2744,12 @@ function ekdosis.appout() | |||
2646 | table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS{}") | 2744 | table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS{}") |
2647 | -- table.insert(output, "\\noindent ") | 2745 | -- table.insert(output, "\\noindent ") |
2648 | for i in string.gmatch(t, | 2746 | for i in string.gmatch(t, |
2649 | "<"..cur_abs_pg.."%-"..curcol.."%-0>.-</"..cur_abs_pg.."%-"..curcol.."%-0>") | 2747 | "<"..cur_abs_pg |
2748 | ..cur_alignment_patt | ||
2749 | ..curcol.."%-0>.-</" | ||
2750 | ..cur_abs_pg | ||
2751 | ..cur_alignment_patt | ||
2752 | ..curcol.."%-0>") | ||
2650 | do | 2753 | do |
2651 | table.insert(output, i) | 2754 | table.insert(output, i) |
2652 | end | 2755 | end |
@@ -2655,7 +2758,12 @@ function ekdosis.appout() | |||
2655 | local n = 1 | 2758 | local n = 1 |
2656 | while apparatuses[n] | 2759 | while apparatuses[n] |
2657 | do | 2760 | do |
2658 | if string.match(t, "<"..cur_abs_pg.."%-"..curcol.."%-"..n..">.-</"..cur_abs_pg.."%-"..curcol.."%-"..n..">") | 2761 | if string.match(t, "<"..cur_abs_pg.. |
2762 | cur_alignment_patt | ||
2763 | ..curcol.."%-"..n..">.-</" | ||
2764 | ..cur_abs_pg | ||
2765 | ..cur_alignment_patt | ||
2766 | ..curcol.."%-"..n..">") | ||
2659 | then | 2767 | then |
2660 | -- table.insert(output, "BEGIN") | 2768 | -- table.insert(output, "BEGIN") |
2661 | table.insert(output, "\\bgroup{}") | 2769 | table.insert(output, "\\bgroup{}") |
@@ -2704,7 +2812,12 @@ function ekdosis.appout() | |||
2704 | table.insert(output, "\\relax") | 2812 | table.insert(output, "\\relax") |
2705 | end | 2813 | end |
2706 | for i in string.gmatch(t, | 2814 | for i in string.gmatch(t, |
2707 | "<"..cur_abs_pg.."%-"..curcol.."%-"..n..">.-</"..cur_abs_pg.."%-"..curcol.."%-"..n..">") | 2815 | "<"..cur_abs_pg |
2816 | ..cur_alignment_patt | ||
2817 | ..curcol.."%-"..n..">.-</" | ||
2818 | ..cur_abs_pg | ||
2819 | ..cur_alignment_patt | ||
2820 | ..curcol.."%-"..n..">") | ||
2708 | do | 2821 | do |
2709 | table.insert(output, i) | 2822 | table.insert(output, i) |
2710 | end | 2823 | end |
@@ -2721,8 +2834,8 @@ function ekdosis.appout() | |||
2721 | end | 2834 | end |
2722 | f:close() | 2835 | f:close() |
2723 | str = table.concat(output) | 2836 | str = table.concat(output) |
2724 | str = string.gsub(str, "</"..cur_abs_pg.."%-"..curcol.."%-[0-9]>", "") | 2837 | str = string.gsub(str, "</"..cur_abs_pg..cur_alignment_patt..curcol.."%-[0-9]>", "") |
2725 | str = string.gsub(str, "<"..cur_abs_pg.."%-"..curcol.."%-[0-9]>", " ") | 2838 | str = string.gsub(str, "<"..cur_abs_pg..cur_alignment_patt..curcol.."%-[0-9]>", " ") |
2726 | return str | 2839 | return str |
2727 | else | 2840 | else |
2728 | end | 2841 | end |
@@ -2744,7 +2857,16 @@ local curcol_curabspg = {} | |||
2744 | function ekdosis.testapparatus() | 2857 | function ekdosis.testapparatus() |
2745 | if isfound(curcol_curabspg, curcol.."-"..cur_abs_pg) | 2858 | if isfound(curcol_curabspg, curcol.."-"..cur_abs_pg) |
2746 | then | 2859 | then |
2747 | return "\\boolfalse{do@app}" | 2860 | if newalignment |
2861 | then | ||
2862 | if next(apparatuses) ~= nil then | ||
2863 | reset_bagunits() | ||
2864 | end | ||
2865 | newalignment = false | ||
2866 | return "\\booltrue{do@app}" | ||
2867 | else | ||
2868 | return "\\boolfalse{do@app}" | ||
2869 | end | ||
2748 | else | 2870 | else |
2749 | table.insert(curcol_curabspg, curcol.."-"..cur_abs_pg) | 2871 | table.insert(curcol_curabspg, curcol.."-"..cur_abs_pg) |
2750 | if next(apparatuses) ~= nil then | 2872 | if next(apparatuses) ~= nil then |
@@ -2843,4 +2965,39 @@ end | |||
2843 | % \iffalse | 2965 | % \iffalse |
2844 | %</lua> | 2966 | %</lua> |
2845 | % \fi | 2967 | % \fi |
2846 | \endinput | 2968 | % |
2969 | % \iffalse | ||
2970 | %<*examples> | ||
2971 | % \fi | ||
2972 | % \begin{minted}[firstnumber=last]{latex} | ||
2973 | \documentclass[12pt]{article} | ||
2974 | \usepackage{fontspec} | ||
2975 | \usepackage[english]{babel} | ||
2976 | \babelfont{rm}{Old Standard} | ||
2977 | \babelfont{sf}{NewComputerModern Sans} | ||
2978 | \babelfont{tt}{NewComputerModern Mono} | ||
2979 | |||
2980 | \usepackage[teiexport=tidy]{ekdosis} | ||
2981 | \SetEkdosisAlignment{ | ||
2982 | tcols=1, | ||
2983 | lcols=1, | ||
2984 | texts=specimen[xml:lang="fr"], | ||
2985 | apparatus=specimen} | ||
2986 | |||
2987 | \begin{document} | ||
2988 | |||
2989 | \begin{alignment}[flush] | ||
2990 | \begin{specimen} | ||
2991 | I saw my friend \app{ | ||
2992 | \lem{Peter} | ||
2993 | \rdg{John}} | ||
2994 | at the station yesterday. | ||
2995 | \end{specimen} | ||
2996 | \end{alignment} | ||
2997 | |||
2998 | \end{document} | ||
2999 | % \end{minted} | ||
3000 | % \iffalse | ||
3001 | %</examples> | ||
3002 | % \fi | ||
3003 | \endinput \ No newline at end of file | ||
diff --git a/ekdosis.ins b/ekdosis.ins index 77c955b..b724b43 100644 --- a/ekdosis.ins +++ b/ekdosis.ins | |||
@@ -52,4 +52,14 @@ Running "make install" installs the files in the local TeX tree. | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | \egroup | 54 | \egroup |
55 | \usedir{doc/lualatex/ekdosis} | ||
56 | \generate{ | ||
57 | \file{ekdosis-ex.tex}{ | ||
58 | \from{\jobname.dtx}{examples} | ||
59 | } | ||
60 | } | ||
61 | \usedir{doc/lualatex/ekdosis} | ||
62 | \generate{ | ||
63 | \file{README.txt}{\from{\jobname.dtx}{readme}} | ||
64 | } | ||
55 | \endbatchfile | 65 | \endbatchfile |