aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-04-09 11:32:35 +0200
committerRobert Alessi <alessi@robertalessi.net>2021-04-09 11:32:35 +0200
commit7e59309233835a6ed0c556b0dd3fdd6aa9bcfd9a (patch)
treeacc7764f30b844a1cf34e3c04fb193149a81f6d5
parentbcdf40e8f0bd033bdd6413037fa7d4dd4a63e1b3 (diff)
downloadekdosis-7e59309233835a6ed0c556b0dd3fdd6aa9bcfd9a.tar.gz
allow two consecutive \note{} commands to share the same labelb
-rw-r--r--ekdosis.dtx26
1 files changed, 25 insertions, 1 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index ad01873..f7827de 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -9598,6 +9598,22 @@ local function note_totei(str)
9598 return str 9598 return str
9599end 9599end
9600 9600
9601local function remove_extra_anchors(str)
9602 str = string.gsub(str, "(</note>)(<anchor.->)(<note.->)", function(enote, anchor, bnote)
9603 local id_one = string.gsub(anchor, "(%<anchor )(.-)(/%>)", "%2")
9604 id_one = string.sub(get_attr_value(id_one, "xml:id"), 2, -2)
9605 local id_two = string.match(bnote, "target%=.-right%((.-)%)")
9606 id_two = string.gsub(id_two, ".-right%((.-)%)", "%1")
9607 if id_one == id_two
9608 then
9609 return string.format("%s%s", enote, bnote)
9610 else
9611 return string.format("%s%s%s", enote, anchor, bnote)
9612 end
9613 end)
9614 return str
9615end
9616
9601local function app_totei(str) 9617local function app_totei(str)
9602 str = gsub(str, 9618 str = gsub(str,
9603 dblbkslash * 9619 dblbkslash *
@@ -10302,6 +10318,7 @@ local function textotei(str)
10302 str = xml_entities(str) 10318 str = xml_entities(str)
10303 str = texpatttotei(str) 10319 str = texpatttotei(str)
10304 str = note_totei(str) 10320 str = note_totei(str)
10321 str = remove_extra_anchors(str)
10305 str = app_totei(str) 10322 str = app_totei(str)
10306 str = rdgGrp_totei(str) 10323 str = rdgGrp_totei(str)
10307 str = lem_rdg_totei(str) 10324 str = lem_rdg_totei(str)
@@ -11155,6 +11172,7 @@ local lnlabs = {}
11155local lnlab_salt = 0 11172local lnlab_salt = 0
11156local current_lnlab = nil 11173local current_lnlab = nil
11157local prev_lnlab = nil 11174local prev_lnlab = nil
11175local notelabs = {}
11158local current_notelab = nil 11176local current_notelab = nil
11159local prev_notelab = nil 11177local prev_notelab = nil
11160local current_lemma = nil 11178local current_lemma = nil
@@ -11192,7 +11210,13 @@ end
11192 11210
11193function ekdosis.setnotelab(str) 11211function ekdosis.setnotelab(str)
11194 current_notelab = str 11212 current_notelab = str
11195 return "\\linelabel{" .. current_notelab .. "}" 11213 if isfound(notelabs, current_notelab)
11214 then
11215 return ""
11216 else
11217 table.insert(notelabs, current_notelab)
11218 return "\\linelabel{" .. current_notelab .. "}"
11219 end
11196end 11220end
11197 11221
11198function ekdosis.getnotelab() 11222function ekdosis.getnotelab()