aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx44
1 files 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 = {}
1370function ekdosis.newapparatus(teitype, cmd) 1370function ekdosis.newapparatus(teitype, cmd)
1371 if cmd ~= "app" or "note" 1371 if cmd ~= "app" or "note"
1372 then 1372 then
1373 -- tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] 1373 tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]]
1374 -- .. [[The string `]] .. 1374 ..cmd..
1375 -- .. cmd .. 1375 [[" must be either 'app' or 'note'.}}]])
1376 -- [["' must be either `app' or `note'.}}]])
1377 else 1376 else
1378 if isintable(apparatuses, teitype) 1377 if isintable(apparatuses, teitype)
1379 then 1378 then
1380 -- tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]] 1379 tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]]
1381 -- .. teitype .. 1380 ..teitype..
1382 -- [[" already exists as an apparatus. ]] 1381 [[" already exists.}}]])
1383 -- ..
1384 -- [[Please pick another teitype.}}]])
1385 else 1382 else
1386 table.insert(apparatuses, { a = teitype, b = cmd }) 1383 table.insert(apparatuses, { a = teitype, b = cmd })
1387 end 1384 end
@@ -1427,15 +1424,32 @@ function ekdosis.appout()
1427 f = assert(io.open(tex.jobname..".ekd", "r")) 1424 f = assert(io.open(tex.jobname..".ekd", "r"))
1428 t = f:read("*a") 1425 t = f:read("*a")
1429 local output = {} 1426 local output = {}
1430 for i in string.gmatch(t, 1427 if next(apparatuses) == nil then
1431 "<"..cur_abs_pg.."%-0>.-</"..cur_abs_pg.."%-0>") 1428 -- table.insert(output, "BEGIN")
1432 do 1429 for i in string.gmatch(t,
1433 table.insert(output, i) 1430 "<"..cur_abs_pg.."%-0>.-</"..cur_abs_pg.."%-0>")
1431 do
1432 table.insert(output, i)
1433 end
1434 -- table.insert(output, "END")
1435 else
1436 local n = 1
1437 while apparatuses[n]
1438 do
1439 -- table.insert(output, "BEGIN")
1440 for i in string.gmatch(t,
1441 "<"..cur_abs_pg.."%-"..n..">.-</"..cur_abs_pg.."%-"..n..">")
1442 do
1443 table.insert(output, i)
1444 end
1445 -- table.insert(output, "END")
1446 n = n + 1
1447 end
1434 end 1448 end
1435 f:close() 1449 f:close()
1436 str = table.concat(output) 1450 str = table.concat(output)
1437 str = string.gsub(str, "</"..cur_abs_pg.."%-0>", "") 1451 str = string.gsub(str, "</"..cur_abs_pg.."%-[0-9]>", "")
1438 str = string.gsub(str, "<"..cur_abs_pg.."%-0>", " ") 1452 str = string.gsub(str, "<"..cur_abs_pg.."%-[0-9]>", " ")
1439 return str 1453 return str
1440 else end 1454 else end
1441end 1455end