aboutsummaryrefslogtreecommitdiff
path: root/ekdosis.dtx
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2019-10-01 22:11:56 +0200
committerRobert Alessi <alessi@robertalessi.net>2019-10-01 22:11:56 +0200
commit453f94204f99291fc0bacec256167294f571562d (patch)
tree5ee5a405fd343e313ceeea9ae62494058b023f8d /ekdosis.dtx
parent28d29e5bd799ebc2e3dc7fad1eee9b26b4a4ab65 (diff)
downloadekdosis-453f94204f99291fc0bacec256167294f571562d.tar.gz
generate anchors to be referred to by notes
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r--ekdosis.dtx26
1 files changed, 18 insertions, 8 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index fd1768e..0b941db 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -1267,19 +1267,22 @@ local function note_totei(str)
1267 1267
1268 if left ~= "" and teitype ~= "" 1268 if left ~= "" and teitype ~= ""
1269 then 1269 then
1270 return string.format("<%s type=\"%s\" target=\"#range(right(%s),left(%s))\">%s</%s>", 1270 return string.format(
1271 cmd, teitype, right, left, arg, cmd) 1271 "<%s type=\"%s\" target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
1272 cmd, teitype, right, left, arg, cmd, right)
1272 elseif left ~= "" and teitype == "" 1273 elseif left ~= "" and teitype == ""
1273 then 1274 then
1274 return string.format("<%s target=\"#range(right(%s),left(%s))\">%s</%s>", 1275 return string.format(
1275 cmd, right, left, arg, cmd) 1276 "<%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
1277 cmd, right, left, arg, cmd, right)
1276 elseif left == "" and teitype ~= "" 1278 elseif left == "" and teitype ~= ""
1277 then 1279 then
1278 return string.format("<%s type=\"%s\" target=\"#right(%s)\">%s</%s>", 1280 return string.format(
1279 cmd, teitype, right, arg, cmd) 1281 "<%s type=\"%s\" target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
1282 cmd, teitype, right, arg, cmd, right)
1280 else 1283 else
1281 return string.format("<%s target=\"#right(%s)\">%s</%s>", 1284 return string.format("<%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
1282 cmd, right, arg, cmd) 1285 cmd, right, arg, cmd, right)
1283 end 1286 end
1284 end) 1287 end)
1285 return str 1288 return str
@@ -1419,6 +1422,13 @@ local function cmdtotei(str)
1419 cmdtotags[i].b..">", body) 1422 cmdtotags[i].b..">", body)
1420 end) 1423 end)
1421 end 1424 end
1425 -- temporarily:
1426 str = string.gsub(str, "\\(linelabel)%s?(%b{})",
1427 function(cmd, body)
1428 body = string.sub(body, 2, -2)
1429 body = cmdtotei(body)
1430 return string.format("<anchor xml:id=\"%s\"/>", body)
1431 end)
1422 str = string.gsub(str, "\\(%a+)%s?%*?(%b[])(%b{})", 1432 str = string.gsub(str, "\\(%a+)%s?%*?(%b[])(%b{})",
1423 function(cmd, opt, body) 1433 function(cmd, opt, body)
1424 body = string.sub(body, 2, -2) 1434 body = string.sub(body, 2, -2)