aboutsummaryrefslogtreecommitdiff
path: root/ekdosis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r--ekdosis.dtx90
1 files changed, 64 insertions, 26 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index aadd46b..d6a328e 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -1064,10 +1064,10 @@ Running "make install" installs the files in the local TeX tree.
1064\NewDocumentEnvironment{ekdosis}{+b}{% 1064\NewDocumentEnvironment{ekdosis}{+b}{%
1065 \ekd@setlineno% 1065 \ekd@setlineno%
1066 \runninglinenumbers 1066 \runninglinenumbers
1067 % \EkdosisStart 1067 % \EkdosisColStart
1068 \EkdosisOn#1}{% 1068 \EkdosisOn#1}{%
1069 \EkdosisOff 1069 \EkdosisOff
1070 % \EkdosisStop 1070 % \EkdosisColStop
1071 \endrunninglinenumbers% 1071 \endrunninglinenumbers%
1072 \iftei@export\luadirect{ekdosis.exporttei(\luastringN{#1})}\else\fi} 1072 \iftei@export\luadirect{ekdosis.exporttei(\luastringN{#1})}\else\fi}
1073% \end{macrocode} 1073% \end{macrocode}
@@ -1092,7 +1092,9 @@ Running "make install" installs the files in the local TeX tree.
1092 \endgroup}{% 1092 \endgroup}{%
1093 \ifekd@pagelineation\resetlinenumber\fi 1093 \ifekd@pagelineation\resetlinenumber\fi
1094 \endgroup}{}{} 1094 \endgroup}{}{}
1095\NewDocumentCommand{\EkdosisStart}{}{% 1095\NewDocumentCommand{\EkdosisColStart}{}{%
1096 \ekd@setlineno%
1097 \runninglinenumbers
1096 \ekd@storecol% 1098 \ekd@storecol%
1097 \stepcounter{ekd@lab}% 1099 \stepcounter{ekd@lab}%
1098 \zlabel{ekd:\theekd@lab}% 1100 \zlabel{ekd:\theekd@lab}%
@@ -1103,12 +1105,13 @@ Running "make install" installs the files in the local TeX tree.
1103 \luadirect{tex.sprint(ekdosis.checkresetlineno())} 1105 \luadirect{tex.sprint(ekdosis.checkresetlineno())}
1104 \fi 1106 \fi
1105} 1107}
1106\NewDocumentCommand{\EkdosisStop}{}{% 1108\NewDocumentCommand{\EkdosisColStop}{}{%
1107 \stepcounter{ekd@lab}% 1109 \stepcounter{ekd@lab}%
1108 \zlabel{ekd:\theekd@lab}% 1110 \zlabel{ekd:\theekd@lab}%
1109 \luadirect{% 1111 \luadirect{%
1110 ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}}, 1112 ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}},
1111 "pg_ii")}% 1113 "pg_ii")}%
1114 \endrunninglinenumbers%
1112} 1115}
1113\NewDocumentEnvironment{alignment}{O{}} 1116\NewDocumentEnvironment{alignment}{O{}}
1114{% 1117{%
@@ -1129,6 +1132,7 @@ Running "make install" installs the files in the local TeX tree.
1129 \fi 1132 \fi
1130 } 1133 }
1131 {\end{paracol} 1134 {\end{paracol}
1135 \iftei@export\luadirect{ekdosis.export_coldata_totei()}\fi
1132 \luadirect{ekdosis.flushenvdata()} 1136 \luadirect{ekdosis.flushenvdata()}
1133 \luadirect{ekdosis.flushcolnums()} 1137 \luadirect{ekdosis.flushcolnums()}
1134 } 1138 }
@@ -1966,6 +1970,7 @@ end
1966 1970
1967local aligned_texts = {} 1971local aligned_texts = {}
1968local texts_w_apparatus = {} 1972local texts_w_apparatus = {}
1973local coldata_totei = {}
1969 1974
1970function ekdosis.mkenvdata(str, opt) 1975function ekdosis.mkenvdata(str, opt)
1971 str = str ..";" 1976 str = str ..";"
@@ -1975,8 +1980,10 @@ function ekdosis.mkenvdata(str, opt)
1975 if opt == "texts" then 1980 if opt == "texts" then
1976 repeat 1981 repeat
1977 local nexti = string.find(str, "%;", fieldstart) 1982 local nexti = string.find(str, "%;", fieldstart)
1978 table.insert(aligned_texts, {text = string.sub(str, fieldstart, nexti-1), 1983 table.insert(aligned_texts, { text = string.sub(str, fieldstart, nexti-1),
1979 column = col}) 1984 column = col })
1985 table.insert(coldata_totei, { environment = string.sub(str, fieldstart, nexti-1),
1986 data = {} })
1980 col = col + 1 1987 col = col + 1
1981 fieldstart = nexti + 1 1988 fieldstart = nexti + 1
1982 until fieldstart > string.len(str) 1989 until fieldstart > string.len(str)
@@ -1991,7 +1998,7 @@ function ekdosis.mkenvdata(str, opt)
1991 end 1998 end
1992end 1999end
1993 2000
1994-- the following two variables are already set above 2001-- Reminder: the following two variables are already set above
1995-- local prevcol = nil 2002-- local prevcol = nil
1996-- local curcol = "x" 2003-- local curcol = "x"
1997 2004
@@ -2009,6 +2016,13 @@ end
2009function ekdosis.flushenvdata() 2016function ekdosis.flushenvdata()
2010 aligned_texts = {} 2017 aligned_texts = {}
2011 texts_w_apparatus = {} 2018 texts_w_apparatus = {}
2019 coldata_totei = {}
2020 return true
2021end
2022
2023function ekdosis.storecoldata(nthcol, chunk)
2024 local tindex = tonumber(nthcol) + 1
2025 table.insert(coldata_totei[tindex].data, chunk)
2012 return true 2026 return true
2013end 2027end
2014 2028
@@ -2018,41 +2032,65 @@ function ekdosis.mkenv()
2018 do 2032 do
2019 if isfound(texts_w_apparatus, aligned_texts[i].text) 2033 if isfound(texts_w_apparatus, aligned_texts[i].text)
2020 then 2034 then
2021 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{}" 2035 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{+b}"
2022 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}" 2036 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}"
2023 .."\\EkdosisStart"
2024 .."\\begin{ekdosis}"
2025-- .."\\csname ekd@storecol\\endcsname"
2026 .."\\par" 2037 .."\\par"
2027 .."}{\\end{ekdosis}" 2038 .."\\EkdosisColStart"
2028 .."\\EkdosisStop" 2039 .."\\EkdosisOn#1"
2029 .."\\end{nthcolumn}}") 2040 .."}{\\EkdosisOff"
2030 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{}" 2041 .."\\EkdosisColStop"
2042 .."\\end{nthcolumn}"
2043 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
2044 .. aligned_texts[i].column
2045 ..", \\luastringN{#1})}\\fi"
2046 .."}")
2047 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{+b}"
2031 .."{\\begin{nthcolumn*}{".. aligned_texts[i].column.."}[]" 2048 .."{\\begin{nthcolumn*}{".. aligned_texts[i].column.."}[]"
2032 .."\\EkdosisStart"
2033 .."\\begin{ekdosis}"
2034-- .."\\csname ekd@storecol\\endcsname"
2035 .."\\par" 2049 .."\\par"
2036 .."}{" 2050 .."\\EkdosisColStart"
2037 .."\\end{ekdosis}" 2051 .."\\EkdosisOn#1"
2038 .."\\EkdosisStop" 2052 .."}{\\EkdosisOff"
2039 .."\\end{nthcolumn*}}") 2053 .."\\EkdosisColStop"
2054 .."\\end{nthcolumn*}"
2055 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
2056 .. aligned_texts[i].column
2057 ..", \\luastringN{#1})}\\fi"
2058 .."}")
2040 else 2059 else
2041 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{}" 2060 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{+b}"
2042 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}" 2061 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}"
2043 .."\\par" 2062 .."\\par"
2044 .."}{\\end{nthcolumn}}") 2063 .."#1"
2045 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{}" 2064 .."}{\\end{nthcolumn}"
2065 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
2066 .. aligned_texts[i].column
2067 ..", \\luastringN{#1})}\\fi"
2068 .."}")
2069 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{+b}"
2046 .."{\\begin{nthcolumn*}{"..aligned_texts[i].column.."}[]" 2070 .."{\\begin{nthcolumn*}{"..aligned_texts[i].column.."}[]"
2047 .."\\par" 2071 .."\\par"
2072 .."#1"
2048 .."}{" 2073 .."}{"
2049 .."\\end{nthcolumn*}}") 2074 .."\\end{nthcolumn*}"
2075 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
2076 .. aligned_texts[i].column
2077 ..", \\luastringN{#1})}\\fi"
2078 .."}")
2050 end 2079 end
2051 end 2080 end
2052 str = table.concat(environments) 2081 str = table.concat(environments)
2053 return str 2082 return str
2054end 2083end
2055 2084
2085function ekdosis.export_coldata_totei()
2086 for i = 1,#coldata_totei
2087 do
2088 ekdosis.exporttei("\\begin{".. coldata_totei[i].environment .."}"
2089 .. table.concat(coldata_totei[i].data)
2090 .. "\\end{".. coldata_totei[i].environment .."}")
2091 end
2092end
2093
2056-- handle multiple layers in apparatuses 2094-- handle multiple layers in apparatuses
2057-- 2095--
2058local apparatuses = {} 2096local apparatuses = {}