diff options
-rw-r--r-- | ekdosis.dtx | 26 |
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 |
9599 | end | 9599 | end |
9600 | 9600 | ||
9601 | local 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 | ||
9615 | end | ||
9616 | |||
9601 | local function app_totei(str) | 9617 | local 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 = {} | |||
11155 | local lnlab_salt = 0 | 11172 | local lnlab_salt = 0 |
11156 | local current_lnlab = nil | 11173 | local current_lnlab = nil |
11157 | local prev_lnlab = nil | 11174 | local prev_lnlab = nil |
11175 | local notelabs = {} | ||
11158 | local current_notelab = nil | 11176 | local current_notelab = nil |
11159 | local prev_notelab = nil | 11177 | local prev_notelab = nil |
11160 | local current_lemma = nil | 11178 | local current_lemma = nil |
@@ -11192,7 +11210,13 @@ end | |||
11192 | 11210 | ||
11193 | function ekdosis.setnotelab(str) | 11211 | function 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 | ||
11196 | end | 11220 | end |
11197 | 11221 | ||
11198 | function ekdosis.getnotelab() | 11222 | function ekdosis.getnotelab() |