aboutsummaryrefslogtreecommitdiff
path: root/ekdosis.dtx
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2020-08-05 13:29:14 +0200
committerRobert Alessi <alessi@robertalessi.net>2020-08-05 13:29:14 +0200
commit56f470fca333e41c62f976db64efab40f91c1954 (patch)
treeb09af8dd4c77936c67e534681a628021fa6d47de /ekdosis.dtx
parentc9d393cefb1046142a9fe57b0227ee8d3f5395c4 (diff)
downloadekdosis-56f470fca333e41c62f976db64efab40f91c1954.tar.gz
newfunction checkxmlid(id). it should be some way extended to \label, \cite and the like
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r--ekdosis.dtx55
1 files changed, 50 insertions, 5 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 29c3626..c7c2a67 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -5416,6 +5416,16 @@ local function xmlidfound(element)
5416 return false 5416 return false
5417end 5417end
5418 5418
5419local function checkxmlid(str)
5420 if string.find(str, "^[0-9]")
5421 or string.find(str, "[:; ]")
5422 then
5423 return false
5424 else
5425 return true
5426 end
5427end
5428
5419-- Witnesses 5429-- Witnesses
5420listWit = {} 5430listWit = {}
5421idsRend = {} 5431idsRend = {}
@@ -5477,7 +5487,14 @@ function ekdosis.newwitness(id,
5477 then 5487 then
5478 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 5488 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5479 ..id.. 5489 ..id..
5480 "\" already exists as a xml:id. " 5490 "\" already exists as an xml:id. "
5491 ..
5492 "Please pick another id.}}")
5493 elseif not checkxmlid(id)
5494 then
5495 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5496 ..id..
5497 "\" is not a valid xml:id. "
5481 .. 5498 ..
5482 "Please pick another id.}}") 5499 "Please pick another id.}}")
5483 else 5500 else
@@ -5510,7 +5527,14 @@ function ekdosis.newhand(id, witid, siglum, description)
5510 then 5527 then
5511 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 5528 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5512 ..id.. 5529 ..id..
5513 "\" already exists as a xml:id. " 5530 "\" already exists as an xml:id. "
5531 ..
5532 "Please pick another id.}}")
5533 elseif not checkxmlid(id)
5534 then
5535 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5536 ..id..
5537 "\" is not a valid xml:id. "
5514 .. 5538 ..
5515 "Please pick another id.}}") 5539 "Please pick another id.}}")
5516 else 5540 else
@@ -5560,9 +5584,16 @@ function ekdosis.newscholar(id, siglum)
5560 then 5584 then
5561 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 5585 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5562 ..id.. 5586 ..id..
5563 "\" already exists as a xml:id. " 5587 "\" already exists as an xml:id. "
5564 .. 5588 ..
5565 "Please pick another id.}}") 5589 "Please pick another id.}}")
5590 elseif not checkxmlid(id)
5591 then
5592 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
5593 ..id..
5594 "\" is not a valid xml:id. "
5595 ..
5596 "Please pick another id.}}")
5566 else 5597 else
5567 table.insert(xmlids, {xmlid = id}) 5598 table.insert(xmlids, {xmlid = id})
5568 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) 5599 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
@@ -6616,9 +6647,16 @@ function ekdosis.newscholar(id, siglum)
6616 then 6647 then
6617 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 6648 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
6618 ..id.. 6649 ..id..
6619 "\" already exists as a xml:id. " 6650 "\" already exists as an xml:id. "
6620 .. 6651 ..
6621 "Please pick another id.}}") 6652 "Please pick another id.}}")
6653 elseif not checkxmlid(id)
6654 then
6655 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
6656 ..id..
6657 "\" is not a valid xml:id. "
6658 ..
6659 "Please pick another id.}}")
6622 else 6660 else
6623 table.insert(xmlids, {xmlid = id}) 6661 table.insert(xmlids, {xmlid = id})
6624 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) 6662 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
@@ -6641,10 +6679,17 @@ local function build_envdiv(str)
6641 then 6679 then
6642 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" 6680 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
6643 ..div.. 6681 ..div..
6644 "\" already exists as a xml:id. " 6682 "\" already exists as an xml:id. "
6645 .. 6683 ..
6646 "ekdosis has generated some random id.}}") 6684 "ekdosis has generated some random id.}}")
6647 return "div-"..math.random(1000,9999) 6685 return "div-"..math.random(1000,9999)
6686 elseif not checkxmlid(id)
6687 then
6688 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
6689 ..id..
6690 "\" is not a valid xml:id. "
6691 ..
6692 "Please pick another id.}}")
6648 else 6693 else
6649 table.insert(xmlids, {xmlid = div}) 6694 table.insert(xmlids, {xmlid = div})
6650 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) 6695 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)