summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-11-04 21:36:41 +0000
committerKarl Berry <karl@freefriends.org>2020-11-04 21:36:41 +0000
commit234af88f61d26cbe510fea4b4ad9dd5d7a2bc940 (patch)
treea87d70c9856cc164b46b7a5a58959ea8ae6d48f6 /Master/texmf-dist/tex/lualatex
parent4fd48367b332a49ef36193de6bf329ec365573c3 (diff)
ekdosis (4nov20)
git-svn-id: svn://tug.org/texlive/trunk@56856 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua324
-rw-r--r--Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty174
2 files changed, 399 insertions, 99 deletions
diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua
index 64e444d5912..55d42fbc7bc 100644
--- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua
+++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua
@@ -1,7 +1,7 @@
--[[
This file is part of the `ekdosis' package
-ekdosis -- Typesetting TEI xml compliant critical editions
+ekdosis -- Typesetting TEI xml-compliant critical editions
Copyright (C) 2020 Robert Alessi
Please send error reports and suggestions for improvements to Robert
@@ -90,7 +90,8 @@ local citecmds = lpeg.Cs(lpeg.P("icite")
local next = next
-- General
-xmlids = {}
+local xmlids = {}
+table.insert(xmlids, {xmlid = "scholars"} )
local function xmlidfound(element)
for i = 1,#xmlids do
@@ -112,9 +113,12 @@ local function checkxmlid(str)
end
-- Witnesses
-listWit = {}
-idsRend = {}
-shorthands = {}
+local listWit = {}
+-- Persons/Scholars
+local listPerson = {}
+
+local idsRend = {}
+local shorthands = {}
local function isfound(table, value)
for i = 1,#table do
@@ -257,14 +261,67 @@ function ekdosis.newshorthand(id, rend, xmlids)
return true
end
+function ekdosis.newscholar(id,
+ siglum,
+ rawname,
+ Forename,
+ Surname,
+ AddName,
+ Note)
+ if xmlidfound(id)
+ then
+ tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
+ ..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)
+ table.insert(idsRend, {xmlid = id, abbr = siglum})
+ table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
+ if rawname ~= ""
+ then
+ table.insert(listPerson, {xmlid = id,
+ abbr = siglum,
+ note = Note,
+ persName = {
+ name = rawname}
+ })
+ else
+ table.insert(listPerson, {xmlid = id,
+ abbr = siglum,
+ note = Note,
+ persName = {
+ forename = Forename,
+ surname = Surname,
+ addName = AddName}
+ })
+ end
+ end
+ return true
+end
+
local xmlbibresource = nil
-function ekdosis.setxmlbibresource(str)
- xmlbibresource = str..".xml"
+function ekdosis.addxmlbibresource(str)
+ if string.find(str, "%.xml$")
+ then
+ xmlbibresource = str
+ else
+ xmlbibresource = str..".xml"
+ end
return true
end
-function ekdosis.newscholar(id, siglum)
+function ekdosis.newsource(id, siglum)
if xmlidfound(id)
then
tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
@@ -326,6 +383,7 @@ local cmdtotags = {
{a="LRfootnote", b="note", c=" place=\"bottom\""},
{a="RLfootnote", b="note", c=" place=\"bottom\""},
{a="enquote *", b="quote", c=""},
+ {a="marginpar", b="note", c=" place=\"margin\""},
{a="footnote", b="note", c=" place=\"bottom\""},
{a="enquote", b="quote", c=""},
{a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
@@ -335,15 +393,21 @@ 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="\\addentries%s+%[(.-)%]{(.-)}", b=""},
+ {a="\\addentries%s+{(.-)}", b=""},
+ {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""},
+ {a="\\resetlinenumber%s+%[(.-)%]", b=""},
+ {a="\\resetlinenumber%s+", b=""},
+ {a="\\poemlines%s+{(.-)}", b=""},
{a="\\pagebreak%s+%[[1-4]%]", b=""},
{a="\\pagebreak%s+", b=""},
{a="\\altrfont%s+", b=""},
+ {a="\\mbox%s+{(.-)}", b="%1"},
{a="\\LR%s+{(.-)}", b="%1"},
{a="\\RL%s+{(.-)}", b="%1"}
}
@@ -420,6 +484,10 @@ end
-- Get values of attributes
local function get_attr_value(str, attr)
str = str..","
+ str = string.gsub(str, "%b{}", function(body)
+ body = string.gsub(body, attr, attr.."@ekd")
+ return string.format("%s", body)
+ end)
local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}")
or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,")
or ""
@@ -428,6 +496,7 @@ local function get_attr_value(str, attr)
return string.format("%s", bbraces)
end)
attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1")
+ str = string.gsub(str, attr.."@ekd", attr)
return attrval
end
@@ -452,16 +521,21 @@ local function note_totei(str)
if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
right = get_attr_value(opt, "labelb")
left = get_attr_value(opt, "labele")
- if left ~= ""
+ if right == ""
then
- return string.format(
- "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
- cmd, teitype, right, left, arg, cmd, right)
- elseif left == ""
- then
- return string.format(
- "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
- cmd, teitype, right, arg, cmd, right)
+ return string.format("<%s>%s</%s>", cmd, arg, cmd)
+ else
+ if left ~= ""
+ then
+ return string.format(
+ "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
+ cmd, teitype, right, left, arg, cmd, right)
+ elseif left == ""
+ then
+ return string.format(
+ "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
+ cmd, teitype, right, arg, cmd, right)
+ end
end
end)
return str
@@ -486,6 +560,31 @@ local function app_totei(str)
return str
end
+local function rdgGrp_totei(str)
+ str = gsub(str,
+ dblbkslash *
+ lpeg.Cs("rdgGrp") *
+ spcenc^-1 *
+ bsqbrackets *
+ bcbraces *
+ spcenc^-1,
+ function(bkslash, cmd, opt, arg)
+ opt = string.sub(opt, 2, -2)
+ arg = string.sub(arg, 2, -2)
+ teitype = get_attr_value(opt, "type")
+ if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
+ if opt == ""
+ then
+ return rdgGrp_totei(string.format("<%s>%s</%s>",
+ cmd, arg, cmd))
+ else
+ return rdgGrp_totei(string.format("<%s%s>%s</%s>",
+ cmd, teitype, arg, cmd))
+ end
+ end)
+ return str
+end
+
local function lem_rdg_totei(str)
str = gsub(str,
spcenc^-1 *
@@ -502,6 +601,10 @@ local function lem_rdg_totei(str)
--
teiwit = get_attr_value(opt, "wit")
if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end
+ teisource = get_attr_value(opt, "source")
+ if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end
+ teiresp = get_attr_value(opt, "resp")
+ if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end
teitype = get_attr_value(opt, "type")
if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
--
@@ -511,8 +614,8 @@ local function lem_rdg_totei(str)
cmd, arg, cmd))
else
-- opt = ekdosis.getsiglum(opt, "tei")
- return lem_rdg_totei(string.format("<%s%s%s>%s</%s>",
- cmd, teiwit, teitype, arg, cmd))
+ return lem_rdg_totei(string.format("<%s%s%s%s%s>%s</%s>",
+ cmd, teiwit, teisource, teiresp, teitype, arg, cmd))
end
end)
str = gsub(str, spcenc^-0 * dblbkslash * lemrdg * spcenc^-1 * bcbraces * spcenc^-1,
@@ -530,7 +633,7 @@ end
local function linestotei(str)
-- str = "\n<l>"..str
- str = string.gsub(str, "^%s?(.-)%s?$", "\n<l>%1</l>\n")
+ str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n")
-- str = gsub(str, endpoem, "</l>\n")
str = gsub(str, poemline * spcenc^-1 * lpeg.P("&gt;"), "\n<lb/>")
str = gsub(str, poemline * spcenc^-1, "</l>\n<l>")
@@ -617,7 +720,7 @@ local function icitetotei(str)
* bsqbrackets
* bsqbrackets
* bcbraces
- * bsqbrackets^-1,
+ * (bsqbrackets + bcbraces)^-1,
function(cmd, pre, post, body, opt)
pre = string.sub(pre, 2, -2)
post = string.sub(post, 2, -2)
@@ -638,7 +741,7 @@ local function icitetotei(str)
* spcenc^-1
* bsqbrackets
* bcbraces
- * bsqbrackets^-1,
+ * (bsqbrackets + bcbraces)^-1,
function(cmd, post, body, opt)
post = string.sub(post, 2, -2)
body = string.sub(body, 2, -2)
@@ -657,7 +760,7 @@ local function icitetotei(str)
* citecmds
* spcenc^-1
* bcbraces
- * bsqbrackets^-1,
+ * (bsqbrackets + bcbraces)^-1,
function(cmd, body, opt)
body = string.sub(body, 2, -2)
if not checkxmlid(body)
@@ -709,6 +812,19 @@ local function cmdtotei(str)
return string.format("<ref target=\"%s\">%s</ref>",
teisiglum, printsiglum)
end)
+ str = string.gsub(str, "\\(gap)%s?(%b{})",
+ function(cmd, body)
+ body = string.sub(body, 2, -2)
+ teireason = get_attr_value(body, "reason")
+ if teireason ~= "" then teireason = " reason=\""..teireason.."\"" else end
+ teiunit = get_attr_value(body, "unit")
+ if teiunit ~= "" then teiunit = " unit=\""..teiunit.."\"" else end
+ teiquantity = get_attr_value(body, "quantity")
+ if teiquantity ~= "" then teiquantity = " quantity=\""..teiquantity.."\"" else end
+ teiextent = get_attr_value(body, "extent")
+ if teiextent ~= "" then teiextent = " extent=\""..teiextent.."\"" else end
+ return string.format("<gap%s%s%s%s/>", teireason, teiunit, teiquantity, teiextent)
+ end)
str = gsub(str, lpeg.P("\\") * labelrefcmds * spcenc^-1 * bcbraces,
function(cmd, body)
body = string.sub(body, 2, -2)
@@ -1072,6 +1188,7 @@ local function textotei(str)
str = texpatttotei(str)
str = note_totei(str)
str = app_totei(str)
+ str = rdgGrp_totei(str)
str = lem_rdg_totei(str)
str = relocate_notes(str)
str = versetotei(str)
@@ -1117,68 +1234,113 @@ function ekdosis.openteistream()
f:write("<distributor><!-- Distributor name --></distributor>", "\n")
f:write("</publicationStmt>", "\n")
f:write("<sourceDesc>", "\n")
- f:write("<listWit>", "\n")
- for i = 1,#listWit do
- f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
- f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
- f:write(textotei(listWit[i].detailsDesc), "\n")
- f:write("<msDesc>", "\n")
- if listWit[i].msIdentifier.settlement == ""
- and listWit[i].msIdentifier.institution == ""
- and listWit[i].msIdentifier.repository == ""
- and listWit[i].msIdentifier.collection == ""
- and listWit[i].msIdentifier.idno == ""
- and listWit[i].msIdentifier.msName == ""
+ if next(listWit) == nil and next(listPerson) == nil
+ then
+ f:write("<p>No source, born digital</p>", "\n")
+ else
+ if next(listWit) ~= nil
then
- f:write("<msIdentifier/>", "\n")
- else
- f:write("<msIdentifier>", "\n")
- if listWit[i].msIdentifier.settlement ~= "" then
- f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
+ f:write("<listWit>", "\n")
+ for i = 1,#listWit do
+ f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
+ f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
+ f:write(textotei(listWit[i].detailsDesc), "\n")
+ f:write("<msDesc>", "\n")
+ if listWit[i].msIdentifier.settlement == ""
+ and listWit[i].msIdentifier.institution == ""
+ and listWit[i].msIdentifier.repository == ""
+ and listWit[i].msIdentifier.collection == ""
+ and listWit[i].msIdentifier.idno == ""
+ and listWit[i].msIdentifier.msName == ""
+ then
+ f:write("<msIdentifier/>", "\n")
+ else
+ f:write("<msIdentifier>", "\n")
+ if listWit[i].msIdentifier.settlement ~= "" then
+ f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
else end
- if listWit[i].msIdentifier.institution ~= "" then
- f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
+ if listWit[i].msIdentifier.institution ~= "" then
+ f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
else end
- if listWit[i].msIdentifier.repository ~= "" then
- f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
+ if listWit[i].msIdentifier.repository ~= "" then
+ f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
else end
- if listWit[i].msIdentifier.collection ~= "" then
- f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
+ if listWit[i].msIdentifier.collection ~= "" then
+ f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
else end
- if listWit[i].msIdentifier.idno ~= "" then
- f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
+ if listWit[i].msIdentifier.idno ~= "" then
+ f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
else end
- if listWit[i].msIdentifier.msName ~= "" then
- f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
+ if listWit[i].msIdentifier.msName ~= "" then
+ f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
else end
- f:write("</msIdentifier>", "\n")
+ f:write("</msIdentifier>", "\n")
+ end
+ if listWit[i].handDesc ~= nil then
+ f:write("<physDesc>", "\n")
+ f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
+ local j = 1
+ while listWit[i].handDesc[j]
+ do
+ f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
+ f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
+ f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
+ f:write("</handNote>", "\n")
+ j = j + 1
+ end
+ f:write("</handDesc>", "\n")
+ f:write("</physDesc>", "\n")
+ else end
+ if listWit[i].history ~= nil then
+ f:write("<history>", "\n")
+ f:write("<origin>", "\n")
+ f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
+ f:write("</origin>", "\n")
+ f:write("</history>", "\n")
+ end
+ f:write("</msDesc>", "\n")
+ f:write("</witness>", "\n")
+ end
+ f:write("</listWit>", "\n")
end
- if listWit[i].handDesc ~= nil then
- f:write("<physDesc>", "\n")
- f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
- local j = 1
- while listWit[i].handDesc[j]
- do
- f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
- f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
- f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
- f:write("</handNote>", "\n")
- j = j + 1
+ if next(listPerson) ~= nil
+ then
+ f:write("<listPerson xml:id=\"scholars\">", "\n")
+ for i = 1,#listPerson do
+ f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n")
+ f:write('<persName>', "\n")
+ f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n")
+ if listPerson[i].persName.name ~= nil
+ then
+ f:write(textotei(listPerson[i].persName.name))
+ else
+ if listPerson[i].persName.forename ~= ""
+ then
+ f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n")
+ else
+ f:write("<forename><!-- forename --></forename>", "\n")
+ end
+ if textotei(listPerson[i].persName.surname) ~= ""
+ then
+ f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n")
+ else
+ f:write("<surname><!-- surname --></surname>", "\n")
+ end
+ if textotei(listPerson[i].persName.addName) ~= ""
+ then
+ f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n")
+ end
+ end
+ if listPerson[i].note ~= ""
+ then
+ f:write("<note>", textotei(listPerson[i].note), "</note>", "\n")
+ end
+ f:write('</persName>', "\n")
+ f:write('</person>', "\n")
end
- f:write("</handDesc>", "\n")
- f:write("</physDesc>", "\n")
- else end
- if listWit[i].history ~= nil then
- f:write("<history>", "\n")
- f:write("<origin>", "\n")
- f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
- f:write("</origin>", "\n")
- f:write("</history>", "\n")
+ f:write("</listPerson>", "\n")
end
- f:write("</msDesc>", "\n")
- f:write("</witness>", "\n")
end
- f:write("</listWit>", "\n")
f:write("</sourceDesc>", "\n")
f:write("</fileDesc>", "\n")
f:write("<encodingDesc>", "\n")
@@ -1582,10 +1744,10 @@ function ekdosis.get_bagunits(teitype)
return bagunits[teitype]
end
-local function getapplimit(str)
+local function getapplimit(teitype)
for i = 1,#apparatuses
do
- if apparatuses[i].a == str then
+ if apparatuses[i].a == teitype then
limitfound = apparatuses[i].limit
break
end
@@ -1614,6 +1776,14 @@ function ekdosis.limit_bagunits(teitype)
end
end
+function ekdosis.addto_bagunits(teitype, n)
+ if tonumber(getapplimit(teitype)) ~= 0
+ then
+ n = tonumber(n)
+ bagunits[teitype] = bagunits[teitype] - n
+ end
+end
+
function ekdosis.increment_bagunits(teitype)
bagunits[teitype] = (bagunits[teitype] or 0) + 1
end
diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty
index 3e8a82fbb1f..3e8094f9c14 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/08/14 v1.0 Typesetting TEI xml compliant critical editions]
+ [2020/11/04 v1.1 Typesetting TEI xml-compliant critical editions]
\RequirePackage{iftex}
\RequireLuaTeX
\RequirePackage{expkv-opt}
@@ -64,6 +64,7 @@
initial divs = ekdosis,
unknown-choice divs = \PackageError{ekdosis}{unknown divs=#1}{`divs'
must be either `ekdosis' or `latex'.},
+ bool verse = \if@pkg@verse,
choice parnotes = {false = {},
true = {\@pkg@parnotestrue},
roman = {\@pkg@parnotestrue\@parnotesromantrue}},
@@ -86,7 +87,6 @@
\ekvoProcessLocalOptions{ekdosis}
\RequirePackage{luacode}
\RequirePackage{paracol}
-\RequirePackage{xparse}
\RequirePackage{etoolbox}
\RequirePackage{lineno}
\RequirePackage{keyfloat}
@@ -94,8 +94,11 @@
\RequirePackage{zref-user}
\RequirePackage{zref-abspage}
\RequirePackage{ltxcmds}
-\RequirePackage{atbegshi}
+\RequirePackage{pdftexcmds}
\RequirePackage{ifoddpage}
+\if@pkg@verse
+ \RequirePackage{verse}
+\fi
\if@pkg@parnotes
\RequirePackage{parnotes}
\fi
@@ -145,11 +148,32 @@
\luastringN{#4})}
}
\@onlypreamble\DeclareHand
-\NewDocumentCommand{\DeclareScholar}{m m}{
- \luadirect{ekdosis.newscholar(\luastringN{#1},
- \luastringN{#2})}
+\ekvdefinekeys{ekd@scholar}{
+ store rawname = \rawname@value,
+ store forename = \forename@value,
+ store surname = \surname@value,
+ store addname = \addname@value,
+ store note = \note@value
}
+\NewDocumentCommand{\DeclareScholar}{m m O{}}{%
+ \bgroup
+ \ekvset{ekd@scholar}{#3}
+ \luadirect{ekdosis.newscholar(
+ \luastringN{#1},
+ \luastringN{#2},
+ \luastringO{\rawname@value},
+ \luastringO{\forename@value},
+ \luastringO{\surname@value},
+ \luastringO{\addname@value},
+ \luastringO{\note@value})}
+ \egroup
+ }
\@onlypreamble\DeclareScholar
+\NewDocumentCommand{\DeclareSource}{m m}{
+ \luadirect{ekdosis.newsource(\luastringN{#1},
+ \luastringN{#2})}
+}
+\@onlypreamble\DeclareSource
\NewDocumentCommand{\DeclareShorthand}{m m m}{
\luadirect{ekdosis.newshorthand(\luastringN{#1},
\luastringN{#2},
@@ -189,17 +213,17 @@
\luastringN{#4})}
}
}
-\NewDocumentCommand{\TeXtoTEIPatt}{m m}{%
+\NewDocumentCommand{\TeXtoTEIPat}{m m}{%
\luadirect{ekdosis.newpatttotag(\luastringN{#1}, \luastringN{#2})}
}
\NewDocumentCommand{\SetTEIFileName}{m}{
\luadirect{ekdosis.setteifilename(\luastringN{#1})}
}
\@onlypreamble\SetTEIFileName
-\NewDocumentCommand{\SetxmlBibResource}{m}{
- \luadirect{ekdosis.setxmlbibresource(\luastringN{#1})}
+\NewDocumentCommand{\AddxmlBibResource}{m}{
+ \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})}
}
-\@onlypreamble\SetxmlBibResource
+\@onlypreamble\AddxmlBibResource
\newif\ifekd@mapps
\ekvdefinekeys{ekd@newapp}{
choice direction = {LR = \def\direction@val{LR},
@@ -236,6 +260,10 @@
\egroup
}
\@onlypreamble\DeclareApparatus
+\NewDocumentCommand{\addentries}{O{\ekdan@type} m}{%
+ \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}%
+ \ignorespaces
+}
\newbool{do@app}
\newif\ifekd@state
\newif\ifekd@isinapp
@@ -327,6 +355,7 @@
\ignorespaces}
\newif\ifsubsq@unit
\subsq@unittrue
+\newif\ifekd@inside@app
\def\add@@apparatus{%
\if@pkg@parnotes\parnotes\else\fi%
\if@pkg@footins%
@@ -337,8 +366,10 @@
\if@parnotesroman%
\renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
\parnoteclear\else\fi%
+ \ekd@inside@apptrue
\footnotesize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi%
- \if@pkg@parnotes\parnotes\parnotereset\else\fi%
+ \ekd@inside@appfalse
+ \if@pkg@parnotes\parnotes\parnotereset\else\fi
}%
\egroup%
\fi%
@@ -348,7 +379,9 @@
\if@parnotesroman%
\renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
\parnoteclear\else\fi%
+ \ekd@inside@apptrue
\ekd@appfontsize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi%
+ \ekd@inside@appfalse
\if@pkg@parnotes\parnotes\parnotereset\else\fi%
}%
\fi%
@@ -396,7 +429,7 @@
\NewDocumentCommand{\ekdatbegshihook}{}{%
\ifekd@pagelineation\resetlinenumber\fi
}
-\AtBeginShipout{\ekdatbegshihook}
+\AddToHook{shipout/before}{\ekdatbegshihook}
\newif\ifekd@elidednumbers
\ekvdefinekeys{ekd@lineation}{
choice lineation = {page = \ekd@pagelineationtrue,
@@ -405,6 +438,9 @@
lineation=#1}{`lineation' must be either `page' or `document'.},
code modulonum = \chardef\c@linenumbermodulo#1\relax,
noval modulo = \modulolinenumbers,
+ code vmodulonum = \if@pkg@verse\poemlines{#1}\fi,
+ initial vmodulonum = 1,
+ noval vmodulo = \if@pkg@verse\poemlines{5}\fi,
choice numbers = {elided = \ekd@elidednumberstrue,
full = \ekd@elidednumbersfalse},
unknown-choice numbers = \PackageError{ekdosis}{unknown
@@ -429,6 +465,7 @@
\NewDocumentCommand{\SetDefaultApparatus}{m}{%
\ekvset{appnote}{type=#1}}
\NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{%
+ \leavevmode
\begingroup
\ekvset{appnote}{#1}%
\ekd@isinapptrue%
@@ -443,9 +480,9 @@
\def\current@ref@arg#1#2{{%\textdir TLT%
\unexpanded\expandafter{\ekd@refnumstyle}%
\ifnum%
- \getpagerefnumber{#1}
+ \pdf@strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}}
=
- \getpagerefnumber{#2}
+ 0
\ifnum%
\getrefnumber{#1}
=
@@ -497,9 +534,11 @@
\def\current@ref{{%\textdir TLT%
\unexpanded\expandafter{\ekd@refnumstyle}%
\ifnum%
- \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
+ \pdf@strcmp{%
+ \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
+ {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
=
- \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}
+ 0
\ifnum%
\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
=
@@ -550,6 +589,8 @@
}
\ekvdefinekeys{lem}{
code wit = \def\ekdlr@wit{#1},
+ code source = \def\ekdlr@source{#1},
+ code resp = \def\ekdlr@resp{#1},
code alt = \def\ekdlr@alt{#1},
code pre = \def\ekdlr@pre{#1},
code post = \def\ekdlr@post{#1},
@@ -563,6 +604,8 @@
}
\ekvdefinekeys{rdg}{
code wit = \def\ekdlr@wit{#1},
+ code source = \def\ekdlr@source{#1},
+ code resp = \def\ekdlr@resp{#1},
code alt = \def\ekdlr@alt{#1},
code pre = \def\ekdlr@pre{#1},
code post = \def\ekdlr@post{#1},
@@ -571,6 +614,9 @@
store type = \ekdlr@type,
bool nordg = \ifekdr@nordg
}
+\NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{%
+ \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
+}
\NewDocumentCommand{\lem}{O{} m}{%
\ekd@isinlemtrue%
\luadirect{ekdosis.dolnlab(\luastringN{#2})}%
@@ -623,6 +669,8 @@
\fi
\ifdefined\ekdlr@postwit%
\space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
+ \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
+ \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
\ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
\ifdefined\ekdlr@prewit%
\space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
@@ -660,6 +708,8 @@
\ifdefined\ekdlr@prewit%
\space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
\ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
+ \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
+ \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
\ifdefined\ekdlr@postwit%
\space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
\ifekdl@nosep\else\unexpanded\expandafter{\ekdl@sep}\fi
@@ -705,6 +755,8 @@
\fi
\ifdefined\ekdlr@postwit%
\space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
+ \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
+ \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
\ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
\ifdefined\ekdlr@prewit%
\space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
@@ -733,6 +785,8 @@
\ifdefined\ekdlr@prewit%
\space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
\ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
+ \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
+ \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
\ifdefined\ekdlr@postwit%
\space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
}%
@@ -756,7 +810,7 @@
initial sep = \ekdsep
}
\NewDocumentCommand{\note@noapp}{O{} +m}{%
- \null
+ \leavevmode
\bgroup%
\ekvset{note}{#1}%
\stepcounter{ekd@lab}%
@@ -834,10 +888,10 @@
\bgroup%
\ekvset{ekd@note}{#1}%
\edef\note@contents{%
- \ekvifdefinedNoVal{note}{pre}{}{%
+ \ekvifdefinedNoVal{ekd@note}{pre}{}{%
\unexpanded\expandafter{\pre@value}}%
{\unexpanded{#2}}%
- \ekvifdefinedNoVal{note}{post}{}{%
+ \ekvifdefinedNoVal{ekd@note}{post}{}{%
\unexpanded\expandafter{\post@value}}%
}%
\append@app{\note@contents}%
@@ -848,10 +902,10 @@
\bgroup%
\ekvset{ekd@note}{#1}%
\edef\note@contents{%
- \ekvifdefinedNoVal{note}{pre}{}{%
+ \ekvifdefinedNoVal{ekd@note}{pre}{}{%
\unexpanded\expandafter{\pre@value}}%
\unskip\noexpand\parnote{\unexpanded{#2}}%
- \ekvifdefinedNoVal{note}{post}{}{%
+ \ekvifdefinedNoVal{ekd@note}{post}{}{%
\unexpanded\expandafter{\post@value}}%
}%
\append@app{\note@contents}%
@@ -883,6 +937,51 @@
\fi%
\fi%
}
+\ekvdefinekeys{ekd@corr}{
+ store suppbegin = \suppb@value,
+ store suppend = \suppe@value,
+ store delbegin = \delb@value,
+ store delend = \dele@value,
+ store sicbegin = \sicb@value,
+ store sicend = \sice@value,
+ store gapmark = \gapm@value,
+ initial suppbegin = \ifbool{al@rlmode}{>}{<},
+ initial suppend = \ifbool{al@rlmode}{<}{>},
+ initial delbegin = \ifbool{al@rlmode}{\}}{\{},
+ initial delend = \ifbool{al@rlmode}{\{}{\}},
+ initial sicbegin = \dag,
+ initial sicend = \dag,
+ initial gapmark = ***
+}
+\NewDocumentCommand{\supplied}{m}{%
+ \ifekd@inside@app
+ #1%
+ \else
+ \suppb@value #1\suppe@value
+ \fi
+}
+\NewDocumentCommand{\surplus}{m}{%
+ \ifekd@inside@app
+ #1%
+ \else
+ \delb@value #1\dele@value
+ \fi
+}
+\NewDocumentCommand{\sic}{s m}{%
+ \ifekd@inside@app
+ #2%
+ \else
+ \IfBooleanTF{#1}
+ {\sicb@value #2}
+ {\sicb@value #2\sice@value}%
+ \fi
+}
+\NewDocumentCommand{\gap}{m}{%
+ \gapm@value
+}
+\NewDocumentCommand{\SetCritSymbols}{m}{
+ \ekvset{ekd@corr}{#1}
+}
\NewDocumentCommand{\apparatus}{}{%
\luadirect{tex.sprint(ekdosis.appout())}}
\NewDocumentCommand{\test@apparatus}{}{%
@@ -1048,9 +1147,39 @@
\fi
\endgroup
}
+\if@pkg@verse
+\verselinenumfont{\normalfont\footnotesize}
+\setcounter{poemline}{1}
+\NewDocumentEnvironment{ekdverse}{O{\linewidth}}{%
+ \nolinenumbers
+ \let\linelabel\label
+ \stepcounter{verse@envctr}%
+ \addtocounter{poemline}{-1}\refstepcounter{poemline}%
+ \setcounter{vslineno}{1}%
+ \let\\=\@vscentercr
+ \list{}{\itemsep \z@
+ \itemindent -\vindent%
+ \listparindent\itemindent
+ \parsep \stanzaskip
+ \setlength{\itemsep}{0pt}%
+ \setlength{\topsep}{0pt}%
+ \setlength{\partopsep}{0pt}%
+ \ifdim #1 < \linewidth
+ \rightmargin \z@
+ \setlength{\leftmargin}{\linewidth}%
+ \addtolength{\leftmargin}{-#1}%
+ \addtolength{\leftmargin}{-0.5\leftmargin}%
+ \else
+ \rightmargin \leftmargin
+ \fi
+ \addtolength{\leftmargin}{\vindent}}%
+ \item[]%
+}
+{\endlist}
+\else
\newlength{\ekdverseindentlength}
\setlength{\ekdverseindentlength}{\parindent}
-\newenvironment*{ekdverse}[1][\ekdverseindentlength]{
+\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{
\begin{list}{}{%
\setlength{\leftmargin}{#1}
\setlength{\itemsep}{0pt}
@@ -1059,6 +1188,7 @@
}
\item[]
}{\end{list}}
+\fi
\NewDocumentEnvironment{ekdpar}{}{\par}{\par}
\endinput
%%