From b1802841876e7335c45b4c26c3f2912e14a7163d Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 16 Sep 2019 21:56:48 +0200 Subject: started preparing ekdosis.appout() for typesetting multiple layers of notes --- ekdosis.dtx | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 8181714..a3095ce 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -1370,18 +1370,15 @@ local apparatuses = {} function ekdosis.newapparatus(teitype, cmd) if cmd ~= "app" or "note" then - -- tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] - -- .. [[The string `]] .. - -- .. cmd .. - -- [["' must be either `app' or `note'.}}]]) + tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] + ..cmd.. + [[" must be either 'app' or 'note'.}}]]) else if isintable(apparatuses, teitype) then - -- tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] - -- .. teitype .. - -- [[" already exists as an apparatus. ]] - -- .. - -- [[Please pick another teitype.}}]]) + tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] + ..teitype.. + [[" already exists.}}]]) else table.insert(apparatuses, { a = teitype, b = cmd }) end @@ -1427,15 +1424,32 @@ function ekdosis.appout() f = assert(io.open(tex.jobname..".ekd", "r")) t = f:read("*a") local output = {} - for i in string.gmatch(t, - "<"..cur_abs_pg.."%-0>.-") - do - table.insert(output, i) + if next(apparatuses) == nil then + -- table.insert(output, "BEGIN") + for i in string.gmatch(t, + "<"..cur_abs_pg.."%-0>.-") + do + table.insert(output, i) + end + -- table.insert(output, "END") + else + local n = 1 + while apparatuses[n] + do + -- table.insert(output, "BEGIN") + for i in string.gmatch(t, + "<"..cur_abs_pg.."%-"..n..">.-") + do + table.insert(output, i) + end + -- table.insert(output, "END") + n = n + 1 + end end f:close() str = table.concat(output) - str = string.gsub(str, "", "") - str = string.gsub(str, "<"..cur_abs_pg.."%-0>", " ") + str = string.gsub(str, "", "") + str = string.gsub(str, "<"..cur_abs_pg.."%-[0-9]>", " ") return str else end end -- cgit v1.2.3