diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua | 327 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty | 160 |
2 files changed, 410 insertions, 77 deletions
diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua index cab5b029694..64e444d5912 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua @@ -57,10 +57,35 @@ local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") + lpeg.P("section") + lpeg.P("subsection") + lpeg.P("subsubsection")) -local par = lpeg.P(lpeg.P("\\par") * spce^1) -local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^1) -local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^1) - +local par = lpeg.P(lpeg.P("\\par") * spce^0) +local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^0) +local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^0) +local labelrefcmds = lpeg.Cs(lpeg.P("label") + + lpeg.P("linelabel") + + lpeg.P("lineref") + + lpeg.P("ref") + + lpeg.P("pageref") + + lpeg.P("vref") + + lpeg.P("vpageref")) +local citecmds = lpeg.Cs(lpeg.P("icite") + + lpeg.P("cite") + + lpeg.P("Cite") + + lpeg.P("cite *") + + lpeg.P("parencite") + + lpeg.P("Parencite") + + lpeg.P("parencite *") + + lpeg.P("footcite") + + lpeg.P("footcitetext") + + lpeg.P("textcite") + + lpeg.P("Textcite") + + lpeg.P("smartcite") + + lpeg.P("Smartcite") + + lpeg.P("autocite") + + lpeg.P("Autocite") + + lpeg.P("autocite *") + + lpeg.P("Autocite *") +) +-- -- Bind to local variables local next = next @@ -76,6 +101,16 @@ local function xmlidfound(element) return false end +local function checkxmlid(str) + if string.find(str, "^[0-9]") + or string.find(str, "[:; ]") + then + return false + else + return true + end +end + -- Witnesses listWit = {} idsRend = {} @@ -137,7 +172,14 @@ function ekdosis.newwitness(id, then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" ..id.. - "\" already exists as a xml:id. " + "\" already exists as an xml:id. " + .. + "Please pick another id.}}") + elseif not checkxmlid(id) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..id.. + "\" is not a valid xml:id. \\MessageBreak " .. "Please pick another id.}}") else @@ -170,7 +212,14 @@ function ekdosis.newhand(id, witid, siglum, description) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" ..id.. - "\" already exists as a xml:id. " + "\" already exists as an xml:id. " + .. + "Please pick another id.}}") + elseif not checkxmlid(id) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..id.. + "\" is not a valid xml:id. \\MessageBreak " .. "Please pick another id.}}") else @@ -220,9 +269,16 @@ function ekdosis.newscholar(id, siglum) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" ..id.. - "\" already exists as a xml:id. " + "\" already exists as an xml:id. " .. "Please pick another id.}}") + elseif not checkxmlid(id) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..id.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") else table.insert(xmlids, {xmlid = id}) table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) @@ -279,18 +335,17 @@ local cmdtotags = { {a="textsf", b="hi", c=" rend=\"sf\""}, {a="arbup", b="hi", c=" rend=\"sup\""}, {a="txarb", b="s", c=" xml:lang=\"arb\""}, + {a="mbox", b="", c=""}, {a="arb", b="foreign", c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} } local texpatttotags = { - {a="\\icite%s?%[(.-)%]%[(.-)%]{(.-)}", b="%1 <ref target=\"#%3\">%2</ref>"}, - {a="\\icite%s?%[(.-)%]{(.-)}", b="<ref target=\"#%2\">%1</ref>"}, - {a="\\icite%s?{(.-)}", b="<ptr target=\"#%1\"/>"}, - {a="\\linelabel%s?{(.-)}", b="<anchor xml:id=\"%1\"/>"}, - {a="\\label%s?{(.-)}", b="<anchor xml:id=\"%1\"/>"}, - {a="\\v?pageref%s?{(.-)}", b="<ptr target=\"#%1\"/>"}, - {a="\\v?ref%s?{(.-)}", b="<ptr target=\"#%1\"/>"} + {a="\\pagebreak%s+%[[1-4]%]", b=""}, + {a="\\pagebreak%s+", b=""}, + {a="\\altrfont%s+", b=""}, + {a="\\LR%s+{(.-)}", b="%1"}, + {a="\\RL%s+{(.-)}", b="%1"} } local envtotags = { @@ -299,6 +354,8 @@ local envtotags = { {a="quotation", b="quote", c=""}, {a="ekdverse", b="lg", c=""}, {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, + {a="quoting", b="quote", c=""}, + {a="ekdpar", b="p", c=""}, {a="txarab", b="p", c=" xml:lang=\"arb\""}, {a="center", b="p", c=" rend=\"align(center)\""}, {a="verse", b="lg", c=""}, @@ -553,6 +610,70 @@ local function texpatttotei(str) return str end +local function icitetotei(str) + str = gsub(str, lpeg.P("\\") + * citecmds + * spcenc^-1 + * bsqbrackets + * bsqbrackets + * bcbraces + * bsqbrackets^-1, + function(cmd, pre, post, body, opt) + pre = string.sub(pre, 2, -2) + post = string.sub(post, 2, -2) + body = string.sub(body, 2, -2) + if not checkxmlid(body) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..body.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") + else + end + return string.format("%s <ref target=\"#%s\">%s</ref>", pre, body, post) + end) + str = gsub(str, lpeg.P("\\") + * citecmds + * spcenc^-1 + * bsqbrackets + * bcbraces + * bsqbrackets^-1, + function(cmd, post, body, opt) + post = string.sub(post, 2, -2) + body = string.sub(body, 2, -2) + if not checkxmlid(body) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..body.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") + else + end + return string.format("<ref target=\"#%s\">%s</ref>", body, post) + end) + str = gsub(str, lpeg.P("\\") + * citecmds + * spcenc^-1 + * bcbraces + * bsqbrackets^-1, + function(cmd, body, opt) + body = string.sub(body, 2, -2) + if not checkxmlid(body) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..body.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") + else + end + return string.format("<ptr target=\"#%s\"/>", body) + end) + return str +end + local function cmdtotei(str) for i = 1,#cmdtotags do @@ -588,6 +709,25 @@ local function cmdtotei(str) return string.format("<ref target=\"%s\">%s</ref>", teisiglum, printsiglum) end) + str = gsub(str, lpeg.P("\\") * labelrefcmds * spcenc^-1 * bcbraces, + function(cmd, body) + body = string.sub(body, 2, -2) + if not checkxmlid(body) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..body.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") + else + end + if string.find(cmd, "label") + then + return string.format("<anchor xml:id=\"%s\"/>", body) + else + return string.format("<ptr target=\"#%s\"/>", body) + end + end) str = string.gsub(str, "\\(%a+)%s?%*?(%b[])(%b{})", function(cmd, opt, body) body = string.sub(body, 2, -2) @@ -604,19 +744,36 @@ local function cmdtotei(str) return str end +local teiautopar = true + +function ekdosis.setteiautopar(choice) + if choice == "yes" + then + teiautopar = true + else + teiautopar = false + end + return true +end + local function partotei(str) - str = gsub(str, lpeg.P(lpeg.P("\\par") * spcenc^1)^1, "\\par ") - str = gsub(str, ((para + parb) * par^-1)^2, "\\p@r ") - str = string.gsub(str, "\\p@ra%s+", "<p>") - str = string.gsub(str, "\\p@rb%s+", "</p>") - str = string.gsub(str, "\\p@r%s+", "") - str = string.gsub(str, "%s?\\par%s?", "<p>", 1) - str = string.gsub(str, "(%<p%>)(%s-)(%<%/?div%d?)", "%3") - str = string.gsub(str, "%s?\\par%s?", "</p><p>") - str = string.gsub(str, "<p>%s?</p>", "") - str = string.gsub(str, "(%<p%>)%s?(%</div%>)$", "%2") - str = string.gsub(str, "(%<p%>)%s?$", "") - str = string.gsub(str, "(<p>)%s?(<div.->)", "%2%1") + if teiautopar + then + str = gsub(str, lpeg.P(lpeg.P("\\par") * spcenc^1)^1, "\\par ") + str = gsub(str, ((para + parb) * par^-1)^2, "\\p@r ") + str = string.gsub(str, "\\p@ra%s+", "<p>") + str = string.gsub(str, "\\p@rb%s+", "</p>") + str = string.gsub(str, "\\p@r%s+", "") + str = string.gsub(str, "%s?\\par%s?", "<p>", 1) + str = string.gsub(str, "(%<p%>)(%s-)(%<%/?div%d?)", "%3") + str = string.gsub(str, "%s?\\par%s?", "</p><p>") + str = string.gsub(str, "<p>%s?</p>", "") + str = string.gsub(str, "(%<p%>)%s?(%</div%>)$", "%2") + str = string.gsub(str, "(%<p%>)%s?$", "") + str = string.gsub(str, "(<p>)%s?(<div.->)", "%2%1") + else + str = gsub(str, par + para + parb, "") + end return str end @@ -921,6 +1078,7 @@ local function textotei(str) str = envtotei(str) str = ekddivs_totei(str) str = section_totei(str) + str = icitetotei(str) str = cmdtotei(str) str = self_close_tags(str) str = partotei(str) @@ -1179,7 +1337,7 @@ function ekdosis.newalignment(str) then newalignment = false cur_alignment = "-" - cur_alignment_patt = "-" + cur_alignment_patt = "%-" end return true end @@ -1267,23 +1425,6 @@ end local environment_div = {} -function ekdosis.newscholar(id, siglum) - if xmlidfound(id) - then - tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" - ..id.. - "\" already exists as a xml:id. " - .. - "Please pick another id.}}") - else - table.insert(xmlids, {xmlid = id}) - table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) - table.insert(idsRend, {xmlid = id, abbr = siglum}) - table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end) - end - return true -end - local function build_envdiv(str) if not environment_div[str] then @@ -1296,10 +1437,17 @@ local function build_envdiv(str) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" ..div.. - "\" already exists as a xml:id. " + "\" already exists as an xml:id. " .. "ekdosis has generated some random id.}}") return "div-"..math.random(1000,9999) + elseif not checkxmlid(div) + then + tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" + ..div.. + "\" is not a valid xml:id. \\MessageBreak " + .. + "Please pick another id.}}") else table.insert(xmlids, {xmlid = div}) table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) @@ -1398,7 +1546,8 @@ function ekdosis.newapparatus(teitype, appdelim, appsep, appbhook, - appehook) + appehook, + applimit) if isintable(apparatuses, teitype) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -1411,7 +1560,8 @@ function ekdosis.newapparatus(teitype, delim = appdelim, sep = appsep, bhook = appbhook, - ehook = appehook}) + ehook = appehook, + limit = applimit}) end bagunits[teitype] = 1 return true @@ -1432,6 +1582,38 @@ function ekdosis.get_bagunits(teitype) return bagunits[teitype] end +local function getapplimit(str) + for i = 1,#apparatuses + do + if apparatuses[i].a == str then + limitfound = apparatuses[i].limit + break + end + end + if tonumber(limitfound) ~= nil + then + if tonumber(limitfound) < 10 + then + return 0 + else + return limitfound + end + else + return 0 + end +end + +function ekdosis.limit_bagunits(teitype) + local limit = tonumber(getapplimit(teitype)) + if limit >= 10 and bagunits[teitype] > limit + then + bagunits[teitype] = 2 + return "\\pagebreak" + else + return "" + end +end + function ekdosis.increment_bagunits(teitype) bagunits[teitype] = (bagunits[teitype] or 0) + 1 end @@ -1472,7 +1654,8 @@ function ekdosis.appout() local output = {} if next(apparatuses) == nil then -- table.insert(output, "BEGIN") - table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS{}") + table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS") + table.insert(output, "\\csname ekd@begin@apparatus\\endcsname\\ignorespaces") -- table.insert(output, "\\noindent ") for i in string.gmatch(t, "<"..cur_abs_pg @@ -1489,8 +1672,8 @@ function ekdosis.appout() local n = 1 while apparatuses[n] do - if string.match(t, "<"..cur_abs_pg.. - cur_alignment_patt + if string.match(t, "<"..cur_abs_pg + ..cur_alignment_patt ..curcol.."%-"..n..">.-</" ..cur_abs_pg ..cur_alignment_patt @@ -1603,10 +1786,54 @@ function ekdosis.testapparatus() if next(apparatuses) ~= nil then reset_bagunits() end + newalignment = false return "\\booltrue{do@app}" end end +local function get_ln_prefix(x, y) + for index = 1, string.len(x) + do + if string.sub(x, index, index) ~= string.sub(y, index, index) + then + return string.sub(x, 1, index - 1) + end + end +end + +function ekdosis.numrange(x, y) + xstr = tostring(x) + ystr = tostring(y) + if x == y -- which will never apply + then + return "\\LRnum{" .. xstr .. "}" + elseif string.len(xstr) ~= string.len(ystr) + then + return "\\LRnum{" .. xstr .. "}--\\LRnum{" .. ystr .. "}" + else + common = get_ln_prefix(xstr, ystr) + if string.len(common) == 0 + then + return "\\LRnum{" .. xstr .. "}--\\LRnum{" .. ystr .. "}" + elseif string.sub(xstr, -2, -2) == "1" + then + return "\\LRnum{" + .. string.sub(common, 1, -2) + .. string.sub(xstr, string.len(common), -1) + .. "}--\\LRnum{" + .. string.sub(ystr, string.len(common), -1) + .. "}" + else + return "\\LRnum{" + .. string.sub(common, 1, -1) + .. string.sub(xstr, string.len(common) + 1, -1) + .. "}--\\LRnum{" + .. string.sub(ystr, string.len(common) + 1, -1) + .. "}" + end + end +end + local lnlabs = {} local lnlab_salt = 0 local current_lnlab = nil diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty index ae7abb0f8dc..3e8a82fbb1f 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty @@ -41,7 +41,7 @@ %% Running "make inst" installs the files in the user's TeX tree. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ekdosis} - [2020/07/08 v0.99a Typesetting TEI xml compliant critical editions] + [2020/08/14 v1.0 Typesetting TEI xml compliant critical editions] \RequirePackage{iftex} \RequireLuaTeX \RequirePackage{expkv-opt} @@ -54,7 +54,7 @@ \newif\iftei@export \ekvdefinekeys{ekdosis}{ choice layout = {float = {\@pkg@floattrue}, - footins = {\@pkg@footinstrue}}, + footins = {\@pkg@floatfalse\@pkg@footinstrue}}, initial layout = float, unknown-choice layout = \PackageError{ekdosis}{unknown layout=#1}{`layout' must be either `float' or `footins'.}, @@ -91,8 +91,11 @@ \RequirePackage{lineno} \RequirePackage{keyfloat} \RequirePackage{refcount} -\RequirePackage[user,abspage]{zref} +\RequirePackage{zref-user} +\RequirePackage{zref-abspage} \RequirePackage{ltxcmds} +\RequirePackage{atbegshi} +\RequirePackage{ifoddpage} \if@pkg@parnotes \RequirePackage{parnotes} \fi @@ -100,7 +103,6 @@ \AtEndDocument{ \luadirect{ekdosis.closestream()} } -\renewcommand\linenumberfont{\normalfont\footnotesize} \ekvdefinekeys{ekd@hooks}{ store appfontsize = \ekd@appfontsize, store refnumstyle = \ekd@refnumstyle, @@ -109,7 +111,7 @@ initial refnumstyle = \bfseries, initial postrefnum = ~ } -\NewDocumentCommand{\SetEkdosisHooks}{m}{\ekvset{ekd@hooks}{#1}} +\NewDocumentCommand{\SetHooks}{m}{\ekvset{ekd@hooks}{#1}} \ekvdefinekeys{ekd@witness}{ store settlement = \settlement@value, store institution = \institution@value, @@ -160,6 +162,16 @@ \NewDocumentCommand{\SigLine}{m}{% \luadirect{tex.sprint(ekdosis.basic_cs(\luastringN{#1}))} } +\ekvdefinekeys{tei@settings}{ + choice autopar = {true = \luadirect{ekdosis.setteiautopar("yes")}, + false = {\luadirect{ekdosis.setteiautopar("no")}}}, + initial autopar = true, + unknown-choice autopar = \PackageError{ekdosis}{unknown + autopar=#1}{`autopar' must be either `true' or `false'.} +} +\NewDocumentCommand{\SetTEIxmlExport}{m}{ + \unless\ifekd@state\ekvset{tei@settings}{#1}\fi +} \NewDocumentCommand{\TeXtoTEI}{m m O{}}{% \luadirect{ekdosis.newcmdtotag(\luastringN{#1}, \luastringN{#2}, @@ -195,11 +207,14 @@ unknown-choice direction = \PackageError{ekdosis}{unknown direction=#1}{`direction' must be either `LR' or `RL'.}, store rule = \rule@val, - store delim = \delim@val, + nmeta norule = {rule=none}, + code delim = \def\delim@val{\unexpanded{#1}}, store sep = \sep@val, store bhook = \bhook@val, store ehook = \ehook@val, + store maxentries = \limit@val, initial direction = LR, + initial delim = {}, initial ehook = {\csname ekd@end@apparatus\endcsname} } \NewDocumentCommand{\DeclareApparatus}{m O{}}{ @@ -215,7 +230,8 @@ \luastringO{\delim@val}, \luastringO{\sep@val}, \luastringO{\bhook@val}, - \luastringO{\ehook@val} + \luastringO{\ehook@val}, + \luastringO{\limit@val} )} \egroup } @@ -257,15 +273,32 @@ \noindent \hb@xt@0em{\hss\@makefnmark}#1} \newif\ifrtl@app +\edef\ekdsep{] } +\ekvdefinekeys{default@app}{ + choice direction = {LR = \rtl@appfalse, + RL = \rtl@apptrue}, + unknown-choice direction = \PackageError{ekdosis}{unknown + direction=#1}{`direction' must be either `LR' or `RL'.}, + code sep = \edef\ekdsep{#1}, + store bhook = \ekd@begin@apparatus, + initial bhook = {}, + store ehook = \ekd@end@apparatus, + initial ehook = {}, + store delim = \ekd@unit@delim, + initial delim = {}, + store rule = \ekd@default@rule, + initial rule = \rule{0.4\columnwidth}{0.4pt}, + noval norule = \def\ekd@default@rule{\mbox{}} +} +\NewDocumentCommand{\SetApparatus}{m}{ + \ekvset{default@app}{#1} +} \NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue} \NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse} -\edef\ekdsep{] } \NewDocumentCommand{\SetSeparator}{m}{\edef\ekdsep{#1}} -\edef\ekd@end@apparatus{} +\NewDocumentCommand{\SetBeginApparatus}{m}{\edef\ekd@begin@apparatus{#1}} \NewDocumentCommand{\SetEndApparatus}{m}{\edef\ekd@end@apparatus{#1}} -\def\ekd@unit@delim{} \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}} -\def\ekd@default@rule{\rule{2truein}{0.5pt}} \newif\iffootnoterule \footnoteruletrue \let\dflt@footnoterule\footnoterule @@ -337,11 +370,63 @@ {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}))}} {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}, \luastringO{#1}))}}} +\def\outerlinenumbers{ + \def\makeLineNumberRunning{ + \checkoddpage + \ifoddpage + \linenumberfont\hskip\linenumbersep\hskip\textwidth + \hbox to\linenumberwidth{\hss\LineNumber}\hss + \else + \hss\linenumberfont\LineNumber\hskip\linenumbersep + \fi + } +} +\def\innerlinenumbers{ + \def\makeLineNumberRunning{ + \checkoddpage + \ifoddpage + \hss\linenumberfont\LineNumber\hskip\linenumbersep + \else + \linenumberfont\hskip\linenumbersep\hskip\textwidth + \hbox to\linenumberwidth{\hss\LineNumber}\hss + \fi + } +} +\newif\ifekd@pagelineation +\NewDocumentCommand{\ekdatbegshihook}{}{% + \ifekd@pagelineation\resetlinenumber\fi +} +\AtBeginShipout{\ekdatbegshihook} +\newif\ifekd@elidednumbers +\ekvdefinekeys{ekd@lineation}{ + choice lineation = {page = \ekd@pagelineationtrue, + document = \ekd@pagelineationfalse}, + unknown-choice lineation = \PackageError{ekdosis}{unknown + lineation=#1}{`lineation' must be either `page' or `document'.}, + code modulonum = \chardef\c@linenumbermodulo#1\relax, + noval modulo = \modulolinenumbers, + choice numbers = {elided = \ekd@elidednumberstrue, + full = \ekd@elidednumbersfalse}, + unknown-choice numbers = \PackageError{ekdosis}{unknown + numbers=#1}{`numbers' must be either `elided' or `full'.}, + initial numbers = elided, + choice margin = {right = \rightlinenumbers, + left = \leftlinenumbers, + inner = \innerlinenumbers, + outer = \outerlinenumbers}, + unknown-choice margin = \PackageError{ekdosis}{unknown + margin=#1}{`margin' must be either `left', `right', \MessageBreak + `inner' or `outer'} +} +\NewDocumentCommand{\SetLineation}{m}{ + \ekvset{ekd@lineation}{#1} +} +\renewcommand\linenumberfont{\normalfont\footnotesize} \ekvdefinekeys{appnote}{ store type = \ekdan@type, initial type = default } -\NewDocumentCommand{\EkdosisDefaultApparatus}{m}{% +\NewDocumentCommand{\SetDefaultApparatus}{m}{% \ekvset{appnote}{type=#1}} \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{% \begingroup @@ -394,8 +479,13 @@ \fi % \else + \ifekd@elidednumbers + \luadirect{tex.sprint(ekdosis.numrange(\luastring{\getrefnumber{#1}}, + \luastring{\getrefnumber{#2}}))}% + \else \LRnum{\getrefnumber{#1}}--% \LRnum{\getrefnumber{#2}}% issue the nos + \fi \fi% \else \LRnum{\getrefnumber{#1}}--% @@ -442,8 +532,14 @@ \fi % \else + \ifekd@elidednumbers + \luadirect{tex.sprint(ekdosis.numrange( + \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}, + \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}))}% issue the nos + \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% issue the nos + \fi \fi% \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% @@ -478,6 +574,7 @@ \NewDocumentCommand{\lem}{O{} m}{% \ekd@isinlemtrue% \luadirect{ekdosis.dolnlab(\luastringN{#2})}% + \null \bgroup% \ekvset{lem}{#1}% \ifekd@mapps% @@ -489,6 +586,7 @@ \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% \def\ekd@munit@delim{% \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% + \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}% \fi% \ifekdl@nolem\edef\lem@app{% % \hskip .75em @@ -554,8 +652,8 @@ \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}\unexpanded{#2}}{% - \unexpanded{#2}}% + {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + {\unexpanded{#2}}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -627,8 +725,8 @@ \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}\unexpanded{#2}}{% - \unexpanded{#2}}% + {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + {\unexpanded{#2}}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -653,10 +751,12 @@ code labelb = \def\ekdn@labelb{#1}, code labele = \def\ekdn@labele{#1}, store sep = \ekdn@sep, + bool nosep = \ifekdn@nosep, initial type = default, initial sep = \ekdsep } \NewDocumentCommand{\note@noapp}{O{} +m}{% + \null \bgroup% \ekvset{note}{#1}% \stepcounter{ekd@lab}% @@ -673,6 +773,7 @@ \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% \def\ekd@munit@delim{% \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% + \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}% \fi% \ifdefined\ekdn@labelb% \luadirect{tex.sprint(ekdosis.setnotelab(\luastringO{\ekdn@labelb}))}% @@ -691,7 +792,9 @@ \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem% {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}% - \unexpanded\expandafter{\ekdn@sep}\else\fi% + \unless\ifekdn@nosep + \unexpanded\expandafter{\ekdn@sep}\fi + \else\fi% {\textdir TRT\unexpanded{#2}}}}% {\edef\note@contents{% % \hskip .75em @@ -707,18 +810,21 @@ {\noexpand\selectlanguage{\languagename}% \unexpanded\expandafter{\ekdn@lem}}% {\unexpanded\expandafter{\ekdn@lem}}% - \unexpanded\expandafter{\ekdn@sep}\else\fi% + \unless\ifekdn@nosep + \unexpanded\expandafter{\ekdn@sep}\fi + \else\fi% \ltx@ifpackageloaded{babel}% - {\noexpand\selectlanguage{\languagename}\unexpanded{#2}}{% - \unexpanded{#2}}}}% + {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + {\unexpanded{#2}}}}}% \ifekd@mapps% \unconditional@appin[\ekdan@type]{\note@contents}% \else% \unconditional@appin{\note@contents}% \fi% \luadirect{ekdosis.setprevnotelab(\luastringO{\ekdn@labelb})}% - \egroup% - \subsq@unittrue% + \egroup + \subsq@unittrue + \ignorespaces } \ekvdefinekeys{ekd@note}{ store pre = \pre@value, @@ -730,7 +836,7 @@ \edef\note@contents{% \ekvifdefinedNoVal{note}{pre}{}{% \unexpanded\expandafter{\pre@value}}% - \unexpanded{#2}% + {\unexpanded{#2}}% \ekvifdefinedNoVal{note}{post}{}{% \unexpanded\expandafter{\post@value}}% }% @@ -744,7 +850,7 @@ \edef\note@contents{% \ekvifdefinedNoVal{note}{pre}{}{% \unexpanded\expandafter{\pre@value}}% - \unskip\noexpand\parnote{#2}% + \unskip\noexpand\parnote{\unexpanded{#2}}% \ekvifdefinedNoVal{note}{post}{}{% \unexpanded\expandafter{\post@value}}% }% @@ -804,7 +910,6 @@ \endrunninglinenumbers% \iftei@export \luadirect{ekdosis.exporttei(\luastringN{\par #1\par })}\fi} -\newif\ifekd@pagelineation \ekvdefinekeys{ekd@align}{ store tcols = \tcols@num, store lcols = \lcols@num, @@ -827,7 +932,7 @@ initial apparatus = edition, default segmentation = auto } -\NewDocumentCommand{\SetEkdosisAlignment}{m}{ +\NewDocumentCommand{\SetAlignment}{m}{ \ekvset{ekd@align}{#1} } \patchcmd{\pcol@nextpage}{% @@ -914,7 +1019,7 @@ \MessageBreak `subsubsection', `paragraph' or `subparagraph'.}, initial depth = 1 } -\NewDocumentCommand{\ekdfmtdiv}{m m m}{ +\NewDocumentCommand{\FormatDiv}{m m m}{ \luadirect{ekdosis.fmtdiv(\luastring{#1}, \luastringN{#2}, \luastringN{#3})} @@ -954,6 +1059,7 @@ } \item[] }{\end{list}} +\NewDocumentEnvironment{ekdpar}{}{\par}{\par} \endinput %% %% End of file `ekdosis.sty'. |